Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JDBC Invalid column index exception

Alok PattnaikSep 24 2014 — edited Oct 15 2014

Hi,

I have passed the string as

stmt.setString(3, entry.getValue().toString());

stmt.setString(2, entry.getValue().toString());

stmt.setString(1, entry.getValue().toString());

for SQL Query   SELECT M.TXREFNO,M.PROCESSDATE WHERE  F.PROCESSID=? AND ( M.COUNTRYCODE IN (?) OR M.COUNTRYCODE IS NULL )  AND (M.TXREFNO=?)

but its showing Invalid column index Exception.

Please share your feedback.

Comments

unknown-7404
have passed the string as

stmt.setString(3, entry.getValue().toString());

stmt.setString(2, entry.getValue().toString());

stmt.setString(1, entry.getValue().toString());

for SQL Query   SELECT M.TXREFNO,M.PROCESSDATE WHERE  F.PROCESSID=? AND ( M.COUNTRYCODE IN (?) OR M.COUNTRYCODE IS NULL )  AND (M.TXREFNO=?)

but its showing Invalid column index Exception.

Do NOT try to automate something until you can first do it manually.

If you try to execute a query like that manually you will easily see that the query is NOT valid to begin with. So no amount of fiddling with Java will get it to work until you fix the query itself.

That query has no WHERE clause to tell Oracle what tables to get the data from. You reference columns using 'M' and 'F' but there are NO tables at all so those aliases mean nothing.

1 - 1
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 22 2014
Added on Sep 24 2014
1 comment
92 views