Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / Collections
 

TABLE Exist

SQL> SQL> SET ECHO ON SQL> SET SERVEROUTPUT ON SQL> SQL> DECLARE   2      --Define an index-by table type.   3      TYPE num_table IS TABLE OF NUMBER   4                     INDEX BY BINARY_INTEGER;   5   6      nums num_table;   7      some_num NUMBER;   8  BEGIN   9      nums(10) := 11;  10  11      IF nums.EXISTS(11) THEN  12          some_num := nums(11);  13      ELSE  14          DBMS_OUTPUT.PUT_LINE('Element 11 still does not exist.');  15      END IF;  16  17  END;  18  / Element 11 still does not exist. PL/SQL procedure successfully completed. SQL>