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

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



That did the trick!!! Thank you all.
 
- Darrel

don.barclay@srs.gov wrote:

For a number, you have to use 

let $NBR =  ', ' || to_char(&NBR) 

Don 
----- Forwarded by Don Barclay/WSRC/Srs on 01/22/2004 04:02 PM ----- 
Darrel Scott <darrel_1977@yahoo.com> 
Sent by: sqr-users-admin@sqrug.org 
01/22/2004 03:55 PM Please respond to
sqr-users@sqrug.org


To
sqr-users@sqrug.org cc
Subject
Re: [sqr-users] Creating Comma Delimited Strings for "WHERE IN"    statements




I tried this and I get the below error:

"(SQR 4048) Function or operator '||' must be a string or date argument."

Jamie Harris <JHarris@frederick.edu> wrote:

See if this gets you close to where you need to be:

BEGIN-PROCEDURE ABC
BEGIN-Select
a.ID
a.NBR &NBR
if ($NBR = '')
let $NBR = &NBR ! Initialize the string the first time. 
else
let $NBR = ', ' || &NBR ! Append other numbers to the first one.
end-if

show $NBR

FROM TABLE A
END-Select

END-PROCEDURE



-----------------------------------------------------
James Harris
Junior Systems Programmer/Analyst
Information Technology Division
Frederick Community College
-----------------------------------------------------

>>> darrel_1977@yahoo.com 1/22/2004 3:13:30 PM >>>

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

---------------------------------
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


---------------------------------
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