oracle 用SQL中的WHERE条件更新表

dfuffjeb  于 2023-06-29  发布在  Oracle
关注(0)|答案(2)|浏览(141)
update MGR.DRAFT
set qty = '330' 
where (select * 
       from MGR.DRAFT 
       where unit = '6' 
         and group = 'TT' 
         and loc = 'ciu' 
         and qty = '230.8315625')

此查询将引发错误:
SQL错误:ORA-00936:缺失表达式

5fjcxozz

5fjcxozz1#

update MGR.DRAFT
set qty= '330'
where unit='6' and group='TT' and loc='ciu' and qty='230.8315625'
9nvpjoqh

9nvpjoqh2#

SQL错误:ORA-00936:missing expression当您缺少某些表达式时会出现此错误。
添加此代码:

UPDATE MGR.DRAFT
SET qty = '330'
WHERE EXISTS (
  SELECT *
  FROM MGR.DRAFT
  WHERE unit = '6'
    AND group = 'TT'
    AND loc = 'ciu'
    AND qty = '230.8315625'
);

我希望这将为您工作!!

相关问题