How to Declare an Array in PL/SQL Oracle


PL/SQL language extends a set of the standard Structure Query Language (SQL) statements in Oracle application programs. The PL/SQL procedure includes the DECLARE statement that allows you to define variables of the different types of data stored in user databases, including a group of elements of the same type, such as lists and arrays. By declaring an array in PL/SQL procedure, you can point to a group of the database elements using a single name.

  • Click "Start" in Windows, and then click "SQL Management Console."

  • Type the following code in the open window:


    TYPE integer_varray IS VARRAY(3) OF INTEGER;

    intArray INTEGER_VARRAY := integer_varray(NULL,NULL,NULL);


    dbms_output.put_line('Varray initialized as nulls.');

    FOR i IN 1..3 LOOP

    dbms_output.put ('Integer Varray:'||i);




  • Click "File" and then click "Save" to declare the "integer_varray" array data type in you PL/SQL procedure.

Related Searches


  • Photo Credit Jupiterimages/ Images
Promoted By Zergnet


You May Also Like

  • How to Use SQL Variables in Oracle

    SQL stands for Structured Query Language and is used by database developers to retrieve, update and insert data into databases. PL/SQL, or...

Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

Is DIY in your DNA? Become part of our maker community.
Submit Your Work!