Home:ALL Converter>Foreign key constraint is not working in Oracle

Foreign key constraint is not working in Oracle

Ask Time:2016-05-27T06:29:30         Author:J.Doe

Json Formatter

I read from W3school that this command

P_Id int FOREIGN KEY REFERENCES Persons(P_Id)

will work in PLSQL, when I tried this on Sql Developer then It was throwing an exception of

ORA-00907: missing right parenthesis

after this I replaced this command with following

P_Id int, 
CONSTRAINT fk_PerOrders FOREIGN KEY (P_Id) REFERENCES Persons(P_Id)

and it worked, I want to ask whether the first command is not for oracle or is there something wrong with my oracle.

Author:J.Doe,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/37472070/foreign-key-constraint-is-not-working-in-oracle
yy