Home >> FAQs/Tutorials >> Oracle Tutorials
Oracle Tutorials - Create an Array in PL/SQL
By: FYIcenter.com
(Continued from previous topic...)
How To Create an Array in PL/SQL?
If you want create an array data structure, you can use the collection type VARRAY.
VARRAY stands for Variable Array. Here is a sample script on how to use VARRAY:
SQL> set serveroutput on;
SQL> DECLARE
2 TYPE list IS VARRAY(3) OF VARCHAR(16);
3 domain_list list;
4 BEGIN
5 domain_list := list('google','fyicenter','myspace');
6 DBMS_OUTPUT.PUT_LINE('Second domain: '
7 || domain_list(2));
8 END;
9 /
Second domain: fyicenter
As you can see, to define an array variable, you need to create
your own array type, and use that type to define array variables.
(Continued on next topic...)
- What Is PL/SQL?
- What Are the Types PL/SQL Code Blocks?
- How To Define an Anonymous Block?
- How Many Anonymous Blocks Can Be Defined?
- How To Run the Anonymous Block Again?
- What Is a Stored Program Unit?
- How To Create a Stored Program Unit?
- How To Execute a Stored Program Unit?
- How Many Data Types Are Supported?
- What Are the Execution Flow Control Statements?
- How To Use SQL Statements in PL/SQL?
- How To Process Query Result in PL/SQL?
- How To Create an Array in PL/SQL?
- How To Manage Transaction Isolation Level?
- How To Pass Parameters to Procedures?
- How To Define a Procedure inside Another Procedure?
- What Do You Think about PL/SQL?
|