您好我正在编写oracle查询以支持select in in子句我的查询就像这样
SELECT * FROM country
WHERE
country_id in( IF('test' = 'test',(1,2,3),true) )
如果condition('test'='test')为true,那么它应该像
那样触发查询SELECT * FROM country WHERE country_id in(1,2,3)
否则它应该触发查询
SELECT * FROM country WHERE country_id in(true)
答案 0 :(得分:1)
如果我理解你需要什么,你必须将它分成两个条件:
SELECT *
FROM country
WHERE(('test'='test')AND(country_id IN (1,2,3)))
OR(('test'<>'test')AND(country_id<>0))