Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Nested tables and referential constraints question
Hi!
Is it at all possible to define referential constraints inside nested tables?
I tried this program:
CREATE TYPE X AS OBJECT (
X_A NUMBER PRIMARY KEY,
X_B NUMBER
);
/
CREATE TABLE XS OF X;
CREATE TYPE Y AS OBJECT (
Y_X_REF REF X, -- refers to a X object
);
/
CREATE TYPE NESTED_Y AS TABLE OF Y;
/
CREATE TABLE MY_TAB (
MY_TAB_KEY NUMBER PRIMARY KEY,
YS NESTED_Y
)
NESTED TABLE YS STORE AS Y_TAB;
ALTER TABLE Y_TAB ADD (
CONSTRAINT FK FOREIGN KEY( Y_X_REF ) REFERENCES XS
);
The alter table command fails with ORA-30730:
The online documentation says about this error:
ORA-30730 referential constraint not allowed on nested table column
Cause: An attempt was made to define a referential
constraint on a nested table column.
Action: Do not specify referential constraints on nested table
columns.
This is not very informative... why is it not allowed?
This seems an arbitrary restriction to me and it makes nested
tables a lot less attractive.
Since we thought nested tables were the solution to all (well...)
our problems with our current project, we would really like to know:
Any help on this would be greatly appreciated.
/Stefan Received on Mon Jul 05 1999 - 11:31:08 CDT