Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Help with constraints
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
sony.ant...@gmail.com  
View profile  
 More options Dec 7 2006, 12:31 am
Newsgroups: comp.databases.oracle.server
From: sony.ant...@gmail.com
Date: 6 Dec 2006 21:31:49 -0800
Local: Thurs, Dec 7 2006 12:31 am
Subject: Help with constraints
Hello :
Im trying to setup a constraint between two tables in Oracle 9
TABLE_A has a column( number )  named ROLE_ID

TABLE_B has three columns named ROLE_KEY, REGION and COMPANY

I want to set up a constraint on TABLE_A so that user can only insert
ROLE_IDs such that all the following three conditions are met
1. the value of ROLE_ID should be equal to one of teh existing values
of ROLE_KEY from TABLE_B
2. REGION='US'  ( REGION value for teh matching ROLE_KEY should be US )
3. COMPANY='ABCD'  ( COMPANY value for teh matching ROLE_KEY should be
ABCD )

In other words...
The ROLE_ID being inserted should EXIST in the result of teh query
"select ROLE_KEY from TABLE_B where REGION='US' and COMPANY='ABCD'"

I would preferably have teh solution as a single constraint.

Thanks a lot for reading

--sony


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
orastef  
View profile  
 More options Dec 7 2006, 3:57 am
Newsgroups: comp.databases.oracle.server
From: "orastef" <stefan_k...@gmx.de>
Date: 7 Dec 2006 00:57:02 -0800
Local: Thurs, Dec 7 2006 3:57 am
Subject: Re: Help with constraints
you have to do the constraint with a (update, insert and delete before)
trigger on Table A, which checking the conditions you want. But a
trigger make your insert slow, because there has to be checked
something. But there is no other solution.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »