-
Do I use a Trigger here?
Hi,
I'm no developer but I've been asked to implement this functionality:
I have a table that contains two columns (say A and B) that can contain either '0' or '1'.
1) For an update, column A can only be given the value '1' if the value of column B is also '1' and
2) an insert can only accept the value '1' in column A, if it also contains the value '1' for column B.
Can anyone tell me how to do this?
Thanks
-
create table fred(
a number check(a in (0,1)),
b number check(b in (0,1)),
constraint cons1 check (b=0 or a=b))
Always avoid a trigger if possible.
Last edited by DaPi; 03-30-2006 at 08:19 AM.
"The power of instruction is seldom of much efficacy except in those happy dispositions where it is almost superfluous" - Gibbon, quoted by R.P.Feynman
-
Wow, thank you very much. Perhaps I should go back to selling burgers.
Bye
Peer
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|