oracle - Static in clause sql -
i'm trying put more 1 static in clause in sql (oracle) , not working, 1 has idea or work around it. below i'm trying do
select *  table ('1', '2') in ('1', '2', '3')   i know can done using or clause don't want use there many arguments.
i'm guess query intended flexible handle bunch of input options , dynamically adjust output in way. perhaps approach work. these bi systems going still want syntactically valid query unfortunately can't build whole query dynamically.
with list(val) (     select val master_list_of_values val in (? /* bi_parameter */) ) select * table         in (select id list)     or  b in (select id list)   update: based on edit, work although don't know if generate great plans:
with security_test(passed) (     select count(*) passed     security_groups     group_id in (? /* bi_parameter */) , group_id in (/* hard-coded list */) ) select * table (select passed security_test > 0)   you use hard-code list in values expression instead of using "security_groups" table.
with security_test(passed) (     select count(*) passed     (values (1), (2)) security_groups(group_id)     group_id in (? /* bi_parameter */) ) select * table (select passed security_test > 0)   here's thought...
with security_test(passed) (     select count(*) passed     (values (1), (2)) security_groups(group_id)     group_id in (? /* bi_parameter */)     having count(*) > 0 /* collapse 0 rows? */ ) select * table, security_test      
Comments
Post a Comment