如何比较oracle SQL中的两个select语句
select sum(quantity)
from Table 1
where order_number = XXXX
select sum(quantity)
from Table 2
where order_number = XXXX
如果数量不匹配,应用程序将回滚,如果它们匹配我需要执行更新操作。任何人都可以帮我解决如何在shell脚本中回滚并执行更新操作。
答案 0 :(得分:0)
我会使用内部select语句来执行类似......
的操作SELECT (whatever operations you gonna do) FROM dual WHERE (select sum(quantity) from Table 1 where order_number = XXXX) = (select sum(quantity) from Table 2 where order_number = XXXX);
除此之外,你也可以使用CASE。