In an anonymous block I have an input string that is empty/null and want to check that against a non-null string. Example:
DECLARE
v_notnull varchar2(50):='this string is never null';
v_input varchar2(50):='';
BEGIN
IF trim(v_input) != trim(v_notnull) THEN
dbms_output.put_line('the strings do NOT match');
ELSE
dbms_output.put_line('the strings DO match');
END IF;
END;
The issue here is that when I run this block, the output is always 'the strings DO match'
even though I am inputting the empty string ''
(aka null) into v_input
which is not the same as the string 'this string is never null'
. How can I make sure oracle covers the empty string case? When v_input
is empty I want the output to be 'the strings do NOT match'
.