I have 2 tables in an oracle 12c database and i want to update from 1 table to the next.
Table 1 (EMBLEMTEMPLATE et):
et.emblemtemplate_id, et.customer_id, et.code
Table 2 (PRODUCTLISTPERCUSTOMER):
plpc.productlistpercustomer_id, plpc.customer_id, plpc.emblemtemplate_id,
What i am trying to do:
- Check with all the plpc.productlistpercustomer if there is a plpc.emblemtemplate_id filled, if not this need to be updated.
- plpc.emblemtemplate_id needs to be updated with et.emblemtemplate_id where et.code = "999991"
- The tables must be joined on CUSTOMER_ID
i created a select:
select plpc.customer_id,
plpc.productlistpercustomer_id,
plpc.emblemtemplate_id,
et.customer_id,
et.emblemtemplate_id,
et.code
from productlistpercustomer plpc
inner join emblemtemplate et
on et.customer_id = plpc.customer_id
where et.code = '999991'
Can somebody help me to translate this to a sql update script?
Thanks!