syntax to reference foreign key
SQL>
SQL>
SQL> --CREATE TABLE <table schema> OF <object schema>
SQL> -- (key attribute NOT NULL,
SQL> -- attribute attribute type,
SQL> -- PRIMARY KEY (key attribute),
SQL> -- FOREIGN KEY (key attribute)
SQL> -- REFERENCES <referenced table schema>(key attribute)
SQL> -- [ON DELETE][CASCADE|SET NULL]);
SQL>
SQL> --Example:
SQL>
SQL> CREATE TABLE emp
2 (id VARCHAR2(10) NOT NULL,
3 course VARCHAR2(10),
4 year VARCHAR2(4),
5 PRIMARY KEY (id),
6 FOREIGN KEY (id) REFERENCES Person ON DELETE CASCADE);
SQL> FOREIGN KEY (id) REFERENCES Person ON DELETE CASCADE)
SP2-0734: unknown command beginning "FOREIGN KE..." - rest of line ignored.
SQL>
SQL>
SQL>
SQL>
Related examples in the same category