5 pts.
 Using the SQL IN clause in SQLRPGLE
Can I use a variable with the IN clause in an iSeries SQLRPGLE program? Can I use: WHERE CUSTID IN(:CUSTNUMS) Instead of: WHERE CUSTID IN(145,1600,352)

Software/Hardware used:
ASKED: December 18, 2008  10:09 PM
UPDATED: December 19, 2008  4:40 PM

Answer Wiki:
I am doing this: d SelectedTypes s 30 Inz( *blanks ) d Qt s 1 Inz( X'7D' ) // Build sql IN list values with report types requested For x = 1 to NbrOfTypes; SelectedTypes = %trim(SelectedTypes)+Qt+Type(x)+Qt ; If x < NbrOfTypes; SelectedTypes = %trim(SelectedTypes) + ',' ; Endif; Endfor; stmt = 'Insert Into qtemp/FILEA ' + 'Select * From FILEB ' + 'Where Date(DATEFIELD) >= '+Qt+FromDate+Qt+' and ' + 'TYPE IN('+%trim(SelectedTypes) +')' ;
Last Wiki Answer Submitted:  December 19, 2008  4:40 pm  by  Prairie Dog   15 pts.
All Answer Wiki Contributors:  Prairie Dog   15 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _