Click to See Complete Forum and Search --> : Query for Constraints


avi kumar
02-04-2003, 02:17 AM
Hi

I have Table with Two columns

1)SID
2)Owner

First Time No check on insertion:

user has entered record:
SID owner
1 avi


Next time User inserts with same SID must have owner as avi.
means:

SID owner
1 avi is right entry( This entry can be multiple)

1 Julian is wrong entry


is there any check or constraint in oracle for these types of checks

pls. Suggest
rgds.

Avi kumar

Sameer
02-04-2003, 04:50 AM
You need to write trigger for such kind of requirement... which will check if the new entry is already in the table.. If not then raised an exception ...

I feel you need to work on your table structure.. Why don't you refer to Parent/Child (Foreign key) relationship. Where before inserting a child recond, you need to insert a record into Parent table which will be then refered into Child table.. having a possibility of multiple child records with same Parent Id.

Sameer