Understanding PL/SQL Collections.

0
Understanding PL/SQL Collections:
  • PL/SQL, similar to other programming languages such as C,C++, allows using arrays and records.
  • PL/SQL has two composite types : records and collections.
PL/SQL Records:
  • A PL/SQL Record is allows you to treat several variables as a unit.
  • PL/SQL Record are similar to structure in C.
  • When a “RECORD TYPE” of fields are declared then they can be manipulated as a unit through out the Application.
Note:
  • In the composite data type RECORD, we can specify the data type of the column.
  • Each RECORD defined can have as many Fields as necessary.
  • Fields declared as ‘not null’ must be initialized in the declaration part.
  • A record can be initialized in its declaration part unlike PL/SQL tables, which doesn’t allow initialization in the declaration part.
  • The DEFAULT key word can also be used when defining fields.
  • A RECORD can be the component of another RECORD.
Syntax:
                          TYPE type_name IS RECORD
                          (Element1<data type>,
                          Element2<data type>,
                          Element3<data type>,
                          Element4<data type>,
                          Elementn<data type>);
Field_declaration syntax is 
                          Elementname{ Elementdatatype(size) OR
                                       Recordvariable%TYPE OR
                                       Table.column%TYPE  OR
                                       Table%ROWTYPE}
                                       [[NOT NULL]{:=OR DEFAULT} expr]

About the author

Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus. Aenean fermentum, eget tincidunt.

0 comments:

Recent Posts