[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

RE: [sqr-users] Creating Comma Delimited Strings for "WHERE IN" statements



Set the string up to have a '(' before your program enters its initial select. 
Then concatenate a single quote, the &NBR, another single quote and a comma.
At the end of the initial select (before you call the second select) strip off 
the last comma and adsd ')'.

Richard Knapp
Database Programmer/Analyst
Institutional Research and Planning
University of Missouri System
573-882-8856
knappr@umsystem.edu


-----Original Message-----
From: sqr-users-admin@sqrug.org [mailto:sqr-users-admin@sqrug.org]On
Behalf Of Darrel Scott
Sent: Thursday, January 22, 2004 2:14 PM
To: sqr-users@sqrug.org
Subject: [sqr-users] Creating Comma Delimited Strings for "WHERE IN"
statements



Hello All...

I'm trying to automate a SQL process using SQR. Up to this point, I've never 
had to deal with working with the "IN" portion of SQL within SQR. How do I pass 
a list of returned variables into a comma delimited string? Example:

BEGIN-PROCEDURE ABC
BEGIN-Select
a.ID
a.NBR  &NBR
  Move &NBR to $NBR
FROM TABLE A
END-Select
END-PROCEDURE

Based on the above procedure, I need to format my $NBR string where it now 
becomes ('$NBR','$NBR','$NBR','$NBR',....) for however many instances of &NBR 
procedure ABC returns. This way I can then use the values in the below 
procedure...

BEGIN-PROCEDURE ABC
BEGIN-Select
b.NBR
b.TEXT
FROM TABLE B
WHERE b.NBR in ($NBR)
END-Select
END-PROCEDURE

I will be doing this a few more times in my program and (for now) my values 
that I need passed into separate comma delimited strings are number values.

Any assistance would be greatly appreciated.

Thanks,
Darrel


---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users