如果我要判断一个数是否在一个集合中,我可以这样做
select 1 from dual where (1) in (1,2,3)但如果我要判断一个集合是否被另外一个集合包含,如
select 1 from dual where (1,2) in (1,2,3)
这样写是不符合语法,只能将所有记录(1,2)插入一张表t1,
(1,2,3)插入另外一张表t2,然后查询t1是否有纪录不在t2中,
这样做固然可以解决问题,但是能不能不使用表,写一个函数
完成同样的功能?谢谢,欢迎参加讨论
select 1 from dual where (1) in (1,2,3)但如果我要判断一个集合是否被另外一个集合包含,如
select 1 from dual where (1,2) in (1,2,3)
这样写是不符合语法,只能将所有记录(1,2)插入一张表t1,
(1,2,3)插入另外一张表t2,然后查询t1是否有纪录不在t2中,
这样做固然可以解决问题,但是能不能不使用表,写一个函数
完成同样的功能?谢谢,欢迎参加讨论
select 1 from dual where 1 in (1,2,3) and 2 in (1,2,3)
select 1 from dual where (1,2) in (
select a.col,b.col from t2 a,t2 b)