Database Reference
In-Depth Information
Figure 20.6
REF Constraints
Syntax.
20.2.1.4
REF Constraints
A REF constraint is used to control a relationship determined by a REF
datatype column and the table being referenced (see Chapter 16 for details
on REF datatypes). REF constraint syntax is shown in Figure 20.6.
A REF constraint consists of either a scope definition, a ROWID
pointer, or a Referential Integrity validation between REF column
datatype primary and foreign key definitions. Let's examine these three
options in turn:
SCOPE IS . Scope defines a single table where a referenced row can
be found. Why? A REF datatype is for all intents and purposes an
object pointer. An object pointer can point to any data item in a data-
base, thus it can point to other tables. SCOPE IS simply limits
searching to a single table.
WITH ROWID . This option stores a ROWID pointer value with a
REF datatype value. It should make for faster access but less efficient
use of storage space.
REFERENCES . This option simply allows a foreign key REF
datatype column to be referentially validated against a primary key
superset table using the REF datatype column and a special object
identifier column in the parent table.
Having worked with both object application SDKs and object databases
in the past, I shudder at the thought of creating object structures in a rela-
tional database. This is a personal preference. My reasoning for this prefer-
ence is as follows: PL/SQL should never be used for number crunching.
 
Search WWH ::




Custom Search