I am new in oracle using sql developer in windows 7.I have a problem in which I have to make two tables first:
I have to add a constraint to table tbl_city so that it could accept values for State_Id column only which are exist in S_Id column in tbl_state.For this I have tried to add a sub query in check constraint to mach the values from tbl_state.S_Id but I think Oracle sql does not allow sub query in check constraint.Give me suggestion that how can I solve this Problem.
What you are trying to do is make value in one table to match values in another table which is a foreign key, while check constraint requires a value in the table to
comply with a specified condition. Use:
ALTER TABLE Tbl_State
ADD CONSTRAINT Tbl_State_PK
ALTER TABLE tbl_City
ADD CONSTRAINT tbl_City_FK1