Create a SQL collection type that disallows null values : NOT NULL « Constraints « Oracle PL / SQL






Create a SQL collection type that disallows null values

  

SQL>
SQL> CREATE OR REPLACE TYPE integer_varray
  2    AS VARRAY(100) OF INTEGER NOT NULL;
  3  /

Type created.

SQL>
SQL> DECLARE
  2    intArray INTEGER_VARRAY := integer_varray();
  3  BEGIN
  4    FOR i IN 1..intArray.LIMIT LOOP
  5      intArray.EXTEND;
  6    END LOOP;
  7    dbms_output.put_line('['||intArray.COUNT||']');
  8  END;
  9  /
[100]

PL/SQL procedure successfully completed.

SQL>

   
    
  








Related examples in the same category

1.NOT NULL Column Constraints
2.Change a column to 'not null' with null data in it
3.NOT NULL CONSTRAINT
4.Adding constraint that checks values and prohobits nulls
5.ORA-01400: cannot insert NULL into
6.Add not null constraint to different columns
7.alter table dept modify emp_count NOT NULL