Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / Collections
 

Initialize table collection with null value

SQL> SQL> declare   2    Type numberTableType is TABLE OF NUMBER;   3    v_numarray2 numberTableType;   4  begin   5    v_numarray2 :=numberTableType(NULL);   6   7    if v_numarray2 IS NULL then   8      dbms_output.put_line('v_numarray2 is null');   9    else  10      dbms_output.put_line('v_numarray2 is not null');  11    end if;  12    if v_numarray2(1) IS NULL then  13      dbms_output.put_line('The first element of v_numarray2 is null');  14    end if;  15  end;  16  / v_numarray2 is not null The first element of v_numarray2 is null PL/SQL procedure successfully completed. SQL>