Topic: SQL*Plus and PL/SQL >> PL/SQL Tables
|
Disclaimer: The purpose of all dbapool forums including OCP and Other Oracle Certification forums is to help each other with specific issues but not to share dump and copyrighted exam content, materials or intellectual property.
You may review the entire Oracle Certification Program Candidate Agreement online Here.
|
|
|
|
| jayu |
Posted: Aug 24, 2007 10:17:09 AM |
Total Post: 1
Joined: Aug, 2007
|
Can anyone explain me PL/SQL tables in detail
Thanks
jayu |
|
|
Ramesh Joyisa |
| Posted: Aug 27, 2007 12:51:27 AM | |
|
Total Post: 246
Joined: Aug, 2007
|
PL/SQL provides a composite datatype named TABLE. Objects of type TABLE are
called PL/SQL tables, which are modeled as (but not the same as) database tables.
PL/SQL tables have only one column and use a primary key to give you array-like access to rows. The column can belong to any scalar type (such as CHAR, DATE, or
NUMBER), but the primary key must belong to type BINARY_INTEGER, PLS_
INTEGER or VARCHAR2.
You can declare PL/SQL table types in the declarative part of any block, procedure,
function, or package. In the following example, you declare a TABLE type called
NumTabTyp:
...
DECLARE
TYPE NumTabTyp IS TABLE OF NUMBER
INDEX BY BINARY_INTEGER;
...
BEGIN
...
END;
...
Once you define type NumTabTyp, you can declare PL/SQL tables of that type, as
the next example shows:
num_tab NumTabTyp;
The identifier num_tab represents an entire PL/SQL table.
You reference rows in a PL/SQL table using array-like syntax to specify the primary
key value. For example, you reference the ninth row in the PL/SQL table named
num_tab as follows:
num_tab(9) ...
|
|
|
|
|
| Time Zone: EDT |
Send this thread to your friend |
|
|
|
|
Forum Rules & Description
Who Can Read The Forum? Any registered user or guest
Who Can Post New Topics? Any registered user
Who Can Post Replies? Any registered user
|
| |
Get FREE Magazines
|
Top 10 Forum User
|
| Murtuja Khokhar | 857 |
| Mohammed Taj | 746 |
| positive fanatic | 483 |
| Jayanta Sur | 479 |
| Vigyan Kaushik | 386 |
| Vinoth Kumar | 357 |
| Gopu Gopi | 340 |
| Gitesh Trivedi | 322 |
| neeraj sharma | 258 |
| Ramesh Jois | 246 |
|
|