Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 The Oracle PL/SQL OF Keyword      [Return To Index] Jump to:  
  Looking for the original pages? (formerly called "Morgan's Library") You can find them here.

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      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 72 users online    © 2009 psoug.org
PSOUG LOGIN
Username: 
Password: 
Forgot your password?