I need to create a constraint on a table T1 with columns of interest as ColA and ColB, with a constraint as under :
The Value I insert into ColA should exist on ColB. I cannot create a trigger since it will result into a mutating table, the moment I try to do a select on the table I am residing the trigger on.
I tried this :
ALTER TABLE T1 ADD CONSTRAINT colA_fk FOREIGN KEY (colA) REFERENCES T1(ColB)
However for this ColB must be a PK or unique, which is not the case.
What is a better way of achieving this ( maybe check constraint) ???
Thanks.
The Value I insert into ColA should exist on ColB. I cannot create a trigger since it will result into a mutating table, the moment I try to do a select on the table I am residing the trigger on.
I tried this :
ALTER TABLE T1 ADD CONSTRAINT colA_fk FOREIGN KEY (colA) REFERENCES T1(ColB)
However for this ColB must be a PK or unique, which is not the case.
What is a better way of achieving this ( maybe check constraint) ???
Thanks.