Forum Stats

  • 3,814,871 Users
  • 2,258,922 Discussions
  • 7,892,882 Comments

Discussions

JDBC Invalid column index exception

Alok Pattnaik
Alok Pattnaik Member Posts: 12

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.

Tagged:

Answers

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

This discussion has been closed.