2012-10-02 19 views
0

我是新來的oracle 8i PL/SQL,請幫我用PL/SQL簡單更新,我熟悉T-SQL,但在PL/SQL中混淆。oracle更新與連接語法

Update a 
SET a.column = null 
FROM table1 a INNER JOIN table2 b ON a.fields1=b.fields1 
WHERE a.fields3=[criteria] 

任何幫助將是感激,

RGDS 阿凡

回答

3

Oracle不支持與連接語法更新。 但是你可以如下做到這一點:

update table1 a set field1 = null 
where field3 = [criteria] and 
    exists (select 1 from table2 where field1 = a.field1) 
+0

謝謝Verymuch,救我 – affan25

+0

天歡迎您 –

+1

@ affan25,如果這答案已經通過點擊綠色的勾號來解決你的問題,你可以[接受它](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work)(如果你想的話)。這向更廣泛的社區表明,您的問題已得到解決,並授予答覆者和您一些聲譽。 – Ben

0

我知道這個問題是老了,但是這可能工作:

merge into table1 t 
enter code hereusing (select a.IdColumnt from table1 a INNER JOIN table2 b ON a.fields1=b.fields1 WHERE a.fields3=[criteria]) u 
on t.IdColumnt = u.IdColumnt 
when matched then update set t.column = null; 

commit;