Subject | Re: Error creating table with foreign key |
---|---|
Author | Adam |
Post date | 2005-10-05T06:06:03Z |
Adrian,
I personally prefer named
I am sure it is something simple in your original syntax. I generally
add the table then add a constraint immediately. Out of habit mostly.
CREATE TABLE T2 (F2 INTEGER);
ALTER TABLE T2 ADD CONSTRAINT FK_T2_1 FOREIGN KEY (F2) REFERENCES T1
(P1) ON UPDATE CASCADE ON DELETE CASCADE;
Adam
I personally prefer named
>--------
> SQL> create table T2 (F2 integer foreign key references T1.P1);
> Statement failed, SQLCODE = -104
>
> Dynamic SQL Error
> -SQL error code = -104
> -Token unknown - line 1, char 29
> -foreign
> SQL>
> --------------------------------------------------------------------
I am sure it is something simple in your original syntax. I generally
add the table then add a constraint immediately. Out of habit mostly.
CREATE TABLE T2 (F2 INTEGER);
ALTER TABLE T2 ADD CONSTRAINT FK_T2_1 FOREIGN KEY (F2) REFERENCES T1
(P1) ON UPDATE CASCADE ON DELETE CASCADE;
Adam