Database Reference
In-Depth Information
RARTIST ARTIST%ROWTYPE;
In the following code, a new record structure is built using one
new field (ID), the ARTIST.NAME field, and the SONG.NAME
field. A RECORD datatype is then declared as having the structure
of the new type, TARTISTSONGS.
TYPE TARTISTSONGS IS RECORD (ID INTEGER
, ARTISTS ARTIST.NAME%TYPE
, SONGS SONG.TITLE%TYPE);
RARTISTSONGS TARTISTSONGS;
There are examples using RECORD datatypes later in this chap-
ter when discussing cursors.
Reference Datatypes
. In addition to the REF object pointer type,
PL/SQL also includes a REF cursor. A REF cursor is a by reference
cursor (byref ), which implies that a variable is a pointer and can be
passed into as well as out of a procedure, including returning any
changes made to the REF cursor within the procedure. There will be
more on cursors later in this chapter.
Associative Arrays
. Associative arrays are currently only allowed in
PL/SQL and not Oracle SQL. An associative array is a dynamic array
much like a nested table object (see Chapter 16). The only difference
is that an associative array is indexed and thus capable of much better
performance than a nested table. The following script snippet shows
how an associative array is declared in PL/SQL as opposed to
VARRAYs and nested tables:
DECLARE
TYPE tTable IS TABLE OF VARCHAR2(32);
TYPE tVARRAY IS VARRAY(100) OF INTEGER;
TYPE tITable IS TABLE OF VARCHAR2(32) INDEX BY
BINARY_INTEGER;
vPointer tTable;
vArray tVARRAY;
vIndexedPointer tITable;
BEGIN
NULL;
END;
/
Search WWH ::




Custom Search