Using REF,
DEREF and VALUE
A SCOPE clause in a definition forces a set of
REFs for a given column to be confined to a single object table.
There can be only one REF clause for a given REF column. REF scope
can be set at either the column or table level. REF values can be
stored with ROWID or without ROWID. Storing a REF with a ROWID
speeds dereferencing operations but takes more space. If the WITH
ROWID is not specified with the REF clause, the default is to not
store ROWIDs with the REF values. SCOPE clauses prevent dangling
references as they will not allow REF values without the
corresponding entries in the SCOPE table being present. REF columns
can be added to nested tables by use of the ALTER TABLE command.
The VALUE routine returns the value of a REF
call, much like the DEREF routine. Listing 3 shows the creation of
an object type, a specification of an object table to hold the type
instance and a second table that references the object table. Also
shown are example operations with REF and DEFREF.