Yeah...I've used PREPARE with a cursor, but haven't used EXECUTE or
EXECUTE IMMEDIATE. Looks like I need to use an EXECUTE since EXECUTE
IMMEDIATE doesn't support SELECT INTO.

Thanks!

> -------- Original Message --------
> Subject: Re: Embedded SQL - Variable File Name
> From: rob@xxxxxxxxx
> Date: Fri, December 02, 2005 8:50 am
> To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
> 
> I don't think you can use a variable file name.  Have you ever used the
> PREPARE statement
> and the 
> EXECUTE statement
> or the EXECUTE IMMEDIATE statement?
> 
> Rob Berendt
> -- 
> Group Dekko Services, LLC
> Dept 01.073
> PO Box 2000
> Dock 108
> 6928N 400E
> Kendallville, IN 46755
> http://www.dekko.com
> 
> 
> 
> 
> 
> Michael Ryan <michael@xxxxxxxxxxxxxxxxxx> 
> Sent by: midrange-l-bounces@xxxxxxxxxxxx
> 12/01/2005 08:44 PM
> Please respond to
> Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
> 
> 
> To
> Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
> cc
> 
> Fax to
> 
> Subject
> Embedded SQL - Variable File Name
> 
> 
> 
> 
> 
> 
> (Sorry, but I can't seem to post to the RPG400-L list)
> 
> Why can't I do this?
> 
> C/Exec SQL 
> C+ Select Sum(IOQTYO)
> C+   Into :pWkQuan :WkNull
> C+   From :MyFile 
> C+   Where IOITEM = :pWkItem And
> C+         IOWHSE = 'PH'     And
> C+         IODELE <> 'D'
> C/End-Exec 
> 
> Where MyFile is a variable. I get a "Token : was not valid. Valid tokens: 
> (
> TABLE LATERAL <IDENTIFIER>." message.
> 
> Rob thought it might be because there wasn't a space before my null
> indicator variable, but that didn't seem to fix it. The statement was
> syntactically correct (and worked too!) before I tried a variable file 
> name.
> 
> How can I do this? Do I need a prepared statement with parameter markers?
> Anyone have an example?
> 
> 
> Thanks!
> 
> -- 
> This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing 
> list
> To post a message email: MIDRANGE-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/midrange-l
> or email: MIDRANGE-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/midrange-l.
> 
> 
> -- 
> This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
> To post a message email: MIDRANGE-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/midrange-l
> or email: MIDRANGE-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/midrange-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.