Validating null in pl sql

23-Jan-2020 23:00

select * from t1 where nvl(c1, '') = (select nvl(c2, '') from t2) It is comparing everything except NULL, isnt this equivalent to select * from t1 where c1 = (select c2 from t2 where c2 is not null) and c1 is not null ?

December 29, 2008 - am UTC just select * from t1 where c1 = (select c2 from t2) would do it. but it seems the 'intent' was to make "null=null" in this case - to retrieve nulls (not that their intent was fulfilled - just that is what I think they were trying to do): declare 2 type p is table of int index by varchar2(1); 3 t p; 4 begin 5 t(null) := 1; 6 dbms_output.put_line(t(null)); 7 end; 8 / declare * ERROR at line 1: ORA-06502: PL/SQL: numeric or value error: NULL index table key value ORA-06512: at line 5 March 16, 2012 - am UTC I don't set bugs I file to 'public', I wait for them to be worked on and fixed/resolved before that happens.

In the above example, col1 variable is declared as VARCHAR2 and the empty string is treated as NULL.

SQL DECLARE 2 col1 CHAR(1); 3 BEGIN 4 col1 := ''; 5 DBMS_OUTPUT.

validating null in pl sql-81

2016 hotels dating site

TO_CHAR(LENGTH(col1))); 6 IF (col1 IS NULL) THEN 7 dbms_output.put_line('Treated as NULL'); 8 END IF; 9 IF (col1 = '') THEN 10 dbms_output.put_line('Treated as EMPTY STRING'); 11 END IF; 12 END; 13 / Length :1 PL/SQL procedure successfully completed.

A workaround for behavior consistent with those DBMS's is to use CHAR columns for nullable columns. ----------------------------------------------------------- Tom, how to rate your responses with more then 5 *****?