表列: Id、名称、年龄
第一排:
select 11, 'James', 22 from dual;
这个会回来的
11 James 22
第二排:
select * from supplier where id=11`;
这个会回来的
11 Vinod 25
现在,我想比较两行:
11 James 22
11 Vinod 25
它应该返回有差异的列。
名称错配年龄错配
我正在使用12c是否有内置在甲骨文中的功能,这将解决这个问题。或者任何其他的方法我都可以得到同样的解决方案。
提前谢谢..。
`
发布于 2016-12-28 02:56:07
您可以使用join
和decode
(可以交替使用case
)来确定列值是否匹配:
with cte(id, name, age) as (select 11, 'James', 22 from dual)
select
s.id,
decode(s.name, t.name, null, 'Name mismatch') name_check,
decode(s.age, t.age, null, 'Age mismatch') age_check
from supplier s
inner join cte t
on s.id = t.id
where s.id = 11;
https://stackoverflow.com/questions/41354582
复制相似问题