I need some basic help with getting a trigger and stored procedure working in IDS.
I have a database with category, product, size, primary. I can't force uniqeness, but I can only have one combination of category, product, size, and primary where primary is "Y". I can have multiple Ns. The rows can be populated like:
category product size primary
CAT1 PROD1 SIZE1 Y
CAT1 PROD1 SIZE1 N
CAT1 PROD1 SIZE1 N
CAT2 PROD1 SIZE1 Y
.
.
.
I need to allow users to add and update records, but need to make sure we always only have one record with category, product, size, and primary = Y. Can someone provide an example of a trigger and stored procedure (which is what I think I need to do here) to force this condition?
Thanks in advance,
ag
I have a database with category, product, size, primary. I can't force uniqeness, but I can only have one combination of category, product, size, and primary where primary is "Y". I can have multiple Ns. The rows can be populated like:
category product size primary
CAT1 PROD1 SIZE1 Y
CAT1 PROD1 SIZE1 N
CAT1 PROD1 SIZE1 N
CAT2 PROD1 SIZE1 Y
.
.
.
I need to allow users to add and update records, but need to make sure we always only have one record with category, product, size, and primary = Y. Can someone provide an example of a trigger and stored procedure (which is what I think I need to do here) to force this condition?
Thanks in advance,
ag