For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!
select nvl(null,'Yes, Null it is!') A,nvl('','Oops!, I am null too') B from dual; A B ---------------- -------------------- Yes, Null it is! Oops!, I am null too Elapsed: 00:00:00.00
SQL> create table chk 2 (id number, 3 t varchar2(10)); Table created. SQL> insert into chk values(1,''); 1 row created. SQL> insert into chk values(2,''); 1 row created. SQL> insert into chk values(3,null); 1 row created. SQL> commit; SQL> select * from chk 2 where t is null; ID T ---------- ---------- 1 2 3 SQL> select * from chk 2 where t = ''; no rows selected SQL> insert into chk values('','T'); 1 row created. SQL> select * from chk; ID T ---------- ---------- 1 2 3 T
SQL> declare var char(1) := null; ret integer; begin ret := anydata.convertchar(var).getchar(var); dbms_output.put_line('Length: ' || length(var)); end; / Length: PL/SQL procedure successfully completed.
SQL> declare var char(1) := ''; ret integer; begin ret := anydata.convertchar(var).getchar(var); dbms_output.put_line('Length: ' || length(var)); end; / Length: 1 PL/SQL procedure successfully completed.
col1length|col1data|col2length|col2data|col3length|col3data
3|ABC|5|Hello
3|ABC|0|5|Hello
SQL> ed Wrote file afiedt.buf 1 declare 2 var char(1) := ''; 3 ret integer; 4 begin 5 dbms_output.put_line('var: -' || var ||'-'); 6 ret := anydata.convertchar(var).getchar(var); 7 dbms_output.put_line('Length: ' || length(var)); 8* end; SQL> / var: - - Length: 1 PL/SQL procedure successfully completed.
...
SQL> declare var char (1) := ''; var2 char (1) := null; begin dbms_output.put_line ('Length var: ' || length (var)); dbms_output.put_line ('Length var2: ' || length (var2)); end; / Length var: 1 Length var2: PL/SQL procedure successfully completed.