This doesn't work in Oracle, please help
update mrp_indeksy mrp
inner join indeksy i
on i.indeks_czesci=mrp.indeks_czesci
set mrp.jest_w_raporcie_pzm='N'
where i.id_grupy='WG' and mrp.kod_uzyskania='P' and i.nazwa_czesci NOT LIKE 'ZAWI%'
This doesn't work in Oracle, please help
update mrp_indeksy mrp
inner join indeksy i
on i.indeks_czesci=mrp.indeks_czesci
set mrp.jest_w_raporcie_pzm='N'
where i.id_grupy='WG' and mrp.kod_uzyskania='P' and i.nazwa_czesci NOT LIKE 'ZAWI%'
Generally in Oracle one uses WHERE EXISTS
for update queries of this type:
UPDATE mrp_indeksy mrp
SET mrp.jest_w_raporcie_pzm='N'
WHERE mrp.kod_uzyskania='P'
AND EXISTS ( SELECT 1 FROM indeksy i
WHERE i.indeks_czesci = mrp.indeks_czesci
AND i.id_grupy='WG'
AND i.nazwa_czesci NOT LIKE 'ZAWI%' )
You can read more about how to do an update of this kind at this page. Aside from the WHERE EXISTS
method above, you can also do an "updatable view." However, you can't combine an update with a JOIN
and UPDATE ... FROM
is not valid Oracle syntax.