probleme d'insertion dans table avec cle secondaire
bonjour a tous, je suis devant un probleme que je n'arrive pas resoudre..
j'ai une table price qui contient les champ product_id et start_date qui forment ensemble la cle principale.
Je dois inserer des champs provenant d'une autre table ( table price2)dans laquelle il y a des champs communs avec la table price. j'ai tenter le code suivant:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
insert into price
(product_id,
list_price,
min_price,
start_date,
end_date,
discount)
select
p.product_id,
p2.list_price,
p2.list_price-p2.list_price*p2.discount_available/100,
p2.start_date,
p2.end_date,
p2.discount_available
from product p, ph1_ca_prod_conv_load p1, ph1_ca_price_data_load p2
where old_code=ca_product_code
and p.description=p1.description
and p.product_id in (select product_id from price)
and p.product_id||p2.start_date in (select product_id||start_date from price) |