I m studying databases and am currently working on a object-relational DB project and I ve encountered a small problem with the number of possible constraints in an object table. I m using "Database Systems: The Complete Book" by Hector Garcia-Molina (and other authors) as a reference and there s a general SQL example like this:
CREATE TYPE StarType AS (
name CHAR(30),
address AddressType,
bestMovie REF(MovieType) SCOPE Movies
);
Now, I have a kind of a similar type in my project, as it also uses reference to another type within a type, but the clause for placing a reference there doesn t include SCOPE in Oracle (at least I haven t found it in the docs and it outputs an error). So I have a type like this:
CREATE OR REPLACE TYPE "ApplicationType" AS OBJECT (
"person" REF "PersonType",
"competition" REF "CompetitionType",
"dateApplied" DATE
);
/
...which works. But when I want to constrain the REF columns, I can constrain only one, as so:
CREATE TABLE "Applications" OF "ApplicationType" (
"person" SCOPE IS "People" /* or "competition" SCOPE IS "Competitions" */
)
OBJECT IDENTIFIER IS SYSTEM GENERATED;
Is there any way to give constraints to both REF columns?