2016-03-18 118 views
0

我似乎無法弄清楚語法錯誤在哪裏。儘管查詢非常簡單。ORACLE SQL缺少右括號差語法

在此先感謝!

UPDATE t_stock 
set f_atcid = (select a.id from t_atc a where a.f_code = ' ' where rownum < 2) 
where id in (select f_stockid from t_barcode where f_barcode = ' '); 
+0

什麼是錯誤消息? –

+2

雖然是愚蠢的錯誤,我發現這是一個常見的錯誤(有兩個'where'子句)。我會在網站上保留這個問題。 –

回答

2

問題是兩個where子句。更改第二個爲and

UPDATE t_stock 
    set f_atcid = (select a.id 
        from t_atc a 
        where a.f_code = ' ' and 
----------------------------------------^ 
         rownum < 2 
       ) 
where id in (select f_stockid from t_barcode where f_barcode = ' '); 
+0

多麼愚蠢的錯誤。一切似乎現在工作正常。謝謝! – CoffeMug