Richard Casey skrev den 13-09-2007 22:02:
Ashish,

Instead of using place markers to "hold a spot" for a variable number of
values, you could build the entire SQL statement, including the actual
values, and then prepare that statement and execute it.

For example,

sqlStatement = "select * from mytable where line in (";

sqlStatement = sqlStatement + "'ABC',";
// Repeat previous statement for each value you need to check for. The last
value should not include the trailing comma after the close single-quote.

sqlStatement = sqlStatement + ")";

Then just prepare that statement and execute it.

PrepareStatement is quite expensive and only needed if you either have ?-placeholders or want to repeat it _MANY_ times. The value for _MANY_ varies from database to database, but I believe it was between 20 and 50 for Oracle some years ago.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2022 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.