【发布时间】:2014-09-17 22:25:16
【问题描述】:
当 aif_hyp_acct_type 表中的 account_type 为“”、“R”、“L”、“Q”时,我正在尝试更改 tdataseg 表中金额字段的符号。 aif_hyp_acct_type 是主表。它有 loadid、account 和 account_type 字段。 tdataseg表有account、amount等很多字段。
我尝试了这个查询并得到 ORA-01427 错误。
单行子查询返回多行。
update tdataseg
set tdataseg.amount =
(select decode(sign(tdataseg.amount),-1,abs(tdataseg.amount),1,-abs(tdataseg.amount),0)
from tdataseg, aif_hyp_acct_type
where tdataseg.loadid = aif_hyp_acct_type.loadid
and tdataseg.account = aif_hyp_acct_type.account
and aif_hyp_acct_type.account_type in (' ','R','L','Q'))
【问题讨论】:
-
该错误表明您的
SELECT子查询返回超过 1 行。自行运行并亲自查看。
标签: sql oracle oracle11g sql-update