I.e. if I have this:
codesCsv = 'a,b,c,d,e';
and I want to do this in SQLRPGLE:
I have been using this method:
Which works just fine, but it gets a bit cumbersome if I have several columns with CSV list filters
I wonder if there's a better way?
codesCsv = 'a,b,c,d,e';
and I want to do this in SQLRPGLE:
Code:
exec sql select * from myTable t where t.code "is one of the codes in :codesCsv"
Code:
exec sql with codesList as ( select element from table( systools.split(:codesCsv,',') ) where :codesCsv <> '' -- blank filter means match all, so don't bother invoking split() ) select * from myTable where ( :codesCsv = '' -- blank filter means match all or codes in (select * from codesList); )
I wonder if there's a better way?
Comment