List of Values in a SP Parameter

Tags:
Application development
Crystal Reports
IBM DB2
I need to pass a List of Values parameter from a Crystal Report to a Store Procedure. 1) How do I define the Parm? and 2) How do I code the WHERE clause? Example: Result Sets 1 Language SQL Begin Declare C1 Cursor with Return For Select * From Table1 WHERE Field1 in('Value1', 'Value2','Value3', etc);
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

Is there a way you could write the value list to a temporary table every time you call the SP? Then you wouldn’t have to pass the value list, but call it in you WHERE clause like:

WHERE Field1 in (Select * from table_temp)

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Saratusthra
    Followed Stephen09 advise and coded the following but got some cryptic syntax errors. How can I debug better an iSeries Stored Procedure? Begin CREATE TABLE QTEMP/ALLS(LikeParm CHAR 3)); DECLARE TEMP CURSOR FOR SELECT DISTINCT FieldA FROM TableA; OPEN TEMP ; FETCH TEMP INTO QTEMP/ALLS; CLOSE TEMP ; Declare ByFair Cursor with Return For Select * From Tables WHERE FieldN in (SELECT * FROM QTEMP/ALLS)
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: