Variable in comma separated in the IN CLAUSE of SP of DB2 for Z/OS -
i have sp in have in clause mentioned below value1 int,variable1 varchar suppose sp started variable1=(value1,value2,value3)--getting table
select * tablea column1 in (variable1).
the above statement not working ,needed work around ,please help
here small example of using xml list select arbitrary number of values:
select * "tablea" "column1" in ( select * xmltable('$x/set/row' passing xmlparse(' <set> <row item="1"/> <row item="2"/> <row item="3"/> <!-- add many "row" need here --> </set> ') "x" columns "item" int path '@item' ) x )
then can parameterize query, ?
parameter of type xml
select * "tablea" "column1" in ( select * xmltable('$x/set/row' passing ? "x" columns "item" int path '@item') x )
Comments
Post a Comment