I need to do a table level constraint that does...
in the acct table...if acct_type is "1" then acct_bal must be > 0, if acc_type is "2" then acct_bal must be > 100, etc..
All the fields are within the same table.
Thanks,
Erik
Printable View
I need to do a table level constraint that does...
in the acct table...if acct_type is "1" then acct_bal must be > 0, if acc_type is "2" then acct_bal must be > 100, etc..
All the fields are within the same table.
Thanks,
Erik
write a trigger before insert for each row
I am not allowed to use a trigger for this part...this is a class assignment. I found out today that my entire class is stuck on the same part.
Thanks,
Erik
Code:ALTER TABLE my_table ADD CONSTRAINT check_acct_bal
CHECK (acct_type = '1' AND act_bal > 0
OR
acct_type = '2' AND act_bal > 100
OR
etc....
);