suppose a column defined as:
col varchar2(5)
- If
col='X'istrue; - If
trim(col)=trim('X')istrue; - But if col contains
' ', then iftrim(col)=trim(' ')isfalse;
Why?
Thanks
Oracle doesn't support empty strings like ''; Oracle uses null instead (whenever the result should be an empty string you'll get null in fact). Since
null = null -- <- is null (and not true)
Your formula
trim(col) = trim(' ') -- <- equals to "null = null"
is null (and not true) too
null = null -- <- is always false - this is definitely not true. null = null returns null. Try this: declare test boolean := null = null; begin if test is null then raise program_error; end if; end;. Yes, the idea is the same: condition will not work, but it is not false!
{}toolbar button—I've done it for you this time.