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)
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 Dog15 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.