Quick Search:
 
 The Oracle PL/SQL OF Keyword      [Return To Index] Jump to:  

Term: OF

Definition:
In Oracle PL/SQL, the OF keyword appears in the declaration of a collection type which can be an Associative array, a Nested Table or a Varray. Note that Associative arrays, being a non-persistent collection type, are not available in SQL and as such cannot be stored in the database. The other collection types, Nested Table and Varray, are persistent collections and can be created and stored in the database.

Example Syntax and Usage:

Associative arrays

DECLARE
TYPE TABCOLL IS TABLE OF NUMBER INDEX BY BINARY_INTEGER
BEGIN
...
...
END;
/


Nested Table

SQL> CREATE OR REPLACE TYPE TABCOLL AS TABLE OF NUMBER;
/
Type created.


In PL/SQL:

DECLARE
TYPE [TYPE NAME] IS TABLE OF NUMBER;
BEGIN
...
END;


Varrays

SQL> CREATE OR REPLACE TYPE TABVAR IS VARRAY(5) OF VARCHAR2(100);
/
Type created.


In PL/SQL:

DECLARE
TYPE TABVAR IS VARRAY(5) OF VARCHAR2(500);
BEGIN
...
END;


Related Code Snippets:
 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org