Query for Constraints
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Query for Constraints

  1. #1
    Join Date
    Jan 2003
    Location
    india
    Posts
    10

    Query for Constraints

    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

  2. #2
    Join Date
    Sep 2001
    Location
    Düsseldorf, Germany.
    Posts
    588
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width