Prepare and execute would be one solution.

Be aware that if you dynamically build a statement from user input you
are opening yourself up to SQL injection attacks unless you
parametrized the statement.

--bad
wSqlStmt = 'select * from myfile where location = ' + wLocation;
open C1;

--good
wSqlStmt = 'select * from myfile where location = ?';
open C1 using wLocation;

But as Rob mentions, you can actually do quite a bit with static SQL
that upon first glace you'd need dynamic.

If you post the statements your working on, we could tell for sure.

HTH,
Charles

On Thu, May 6, 2010 at 11:54 AM, Buzz Fenner <bfenner@xxxxxxxxxxxxxxxx> wrote:
I'm just getting my feet wet with SQLRPGLE, so don't - well, you know.
Based on a passed parameter, I need to open a file choosing between two
different select criteria.  I know that you can't do multiple declare
statements using the same cursor (I tried doing that within an if/else);
would using the prepare & execute commands accomplish what I need to do?
Any better solution would definitely be appreciated.  TIA



Buzz Fenner

Systems Analyst/Network Admin

City Water & Light

870.930.3374

mailto:bfenner@xxxxxxxxxxxxxxxx






--
 PRIVACY WARNING: For auditing purposes, a copy of this message has been
 saved in a permanent database.
--
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 ...

Replies:

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.