Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2008
    Posts
    5

    Unanswered: use of Check constraint in data validation rules

    I have two table:
    NodeTable
    MetaNOdeTable

    NodeTable
    ----------------------------
    NodeId :1
    NodeType:Tools (This NodeId & NodeType are column)

    MetaNodeTable
    -------------------------
    NodeId:1
    SubType: Process (This NodeId & SubType are column)


    Here NodeId ofboth the table are the primary key of that table.There is no FOREIGN Key between this two table.
    But there is a validation rules between this two table...i.e. the SubType of MetaNodeTable depends on the NodeType of NodeTable
    Example: If the NodeType of NodeTable is "Tools" the the SubType of MetaNodeTable will be "Process".

    My quwestion is how I can put this validation at the time of data load.Can check constraints work for this?How can I put a constraint for this validation which?
    I have to put the validation such a way that it will show the constraint violation if I try to insert any wrong data.....

    Please help me.....I am waiting for ur reply.....

  2. #2
    Join Date
    Mar 2007
    Posts
    623
    > Can check constraints work for this?
    No, as they check columns in one table.
    But, in your example, I see no need to have that data two tables (as NodeId is primary key of both tables).

    > I have to put the validation such a way that it will show the constraint violation
    Why constraint? Would raising EXCEPTION when wrong data comes satisfy you? I would prefer using it in the stored procedure used for inserting data, however it is possible to use it in a trigger.
    You will have to take special care when parallel inserts/updates come into play; you will have to serialize them in both cases.

  3. #3
    Join Date
    Mar 2008
    Posts
    5
    I need to know what's the difference between trigger & constraints...
    does it work in the same way as constraints?
    Can u help me..?

  4. #4
    Join Date
    Mar 2007
    Posts
    623
    > I need to know what's the difference between trigger & constraints...
    What prevents you from getting this info from documentation, found eg. online at http://tahiti.oracle.com/?

    > does it work in the same way as constraints?
    No, triggers are different. However you cannot use check constraint for your requirement in your current data model (table structures).

    > Can u help me..?
    Unfortunately, "u" is not member of this forum.

Posting Permissions

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