Author |
Topic  |
|
maddyslayer
Yak Posting Veteran
57 Posts |
Posted - 04/18/2013 : 15:54:13
|
I have two tables
Product
prod_cd prod_type prod_active p reg Y q reg Y r reg Y s reg Y t reg Y u reg N v reg N w irreg Y x reg Y
Customer
s_id (Pkey) cus_id prod_cd prod_state 1 1 p y 2 1 q y 3 1 v n 4 1 w n 5 2 s y 6 2 p n 7 2 q y 8 3 p n 9 4 q y 10 5 v n
What is the stored procedure to insert new records for a customer and that cus_id should have a record with each prod cd from the product table where prod_type = reg and prod_active = y and prod_state should be set to N?
What is the stored procedure to loop through the existing customer (cus_id) records and check if they have all the prod_cds with prod_active = N or else add the prod_cds with prod_active = N that are not there and insert those records for that cus_id with prod_state set to N? |
|
visakh16
Very Important crosS Applying yaK Herder
India
52326 Posts |
|
maddyslayer
Yak Posting Veteran
57 Posts |
Posted - 04/22/2013 : 14:31:21
|
It is not user input, each customer has a unique id with different products |
 |
|
visakh16
Very Important crosS Applying yaK Herder
India
52326 Posts |
|
|
Topic  |
|