【问题标题】:ORACLE SQL missing right parenthesis bad syntaxORACLE SQL 缺少右括号语法错误
【发布时间】:2016-03-18 10:46:22
【问题描述】:

我似乎无法弄清楚语法错误在哪里。尽管查询很简单。

提前致谢!

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 = ' ');

【问题讨论】:

  • 错误信息是什么?
  • 虽然是愚蠢的错误,但我发现这是一个常见错误(有两个 where 子句)。我会在网站上保留这个问题。

标签: sql oracle oracle-sqldeveloper


【解决方案1】:

问题在于两个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 = ' ' ); 

【讨论】:

  • 多么愚蠢的错误。现在一切似乎都运行良好。谢谢!
猜你喜欢
  • 1970-01-01
  • 2021-05-06
  • 1970-01-01
  • 2018-07-18
  • 1970-01-01
  • 2018-09-29
  • 1970-01-01
  • 2015-04-16
  • 1970-01-01
相关资源
最近更新 更多