Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Invalid column index -- SQL Exception

 
Rajesh Kumar Sm
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

When i run my java program i am getting the Invalid column index error. But it looks the columns in the query and the code accessing the resultset data are proper. Please look into the below and provide your suggestions to nail down the issue,

Query:
SELECT DISTINCT a.customer,'*****' AS "ORDER_NUMBER",b.cust_po_num,b.cust_line_item,DECODE(b.mkt_part_num,'',b.cus_part_num),b.cr_qty,'$'||b.locunitprice,TO_CHAR(b.cr_date), 'PreGated' FROM XXCYP_OE_ORDER_EDI850_TMP a, XXCYP_OE_ORDER_EDI850_HIST b, XXCYP_OE_ORDER_EDI850_FALLOUT c WHERE a.cust_po_num=b.cust_po_num AND a.cust_po_num=c.cust_po_num AND b.cust_po_num=c.cust_po_num AND a.customer =? ORDER BY b.cust_po_num,b.cust_line_item

Code:

String body = body + rsOrdInfoGated.getString(2) + fillSpaces(12,rsOrdInfoGated.getString(2).length())
+ rsOrdInfoGated.getString(3) + fillSpaces(16,rsOrdInfoGated.getString(3).length())
+ rsOrdInfoGated.getString(4) + fillSpaces(11,rsOrdInfoGated.getString(4).length())
+ rsOrdInfoGated.getString(5) + fillSpaces(25,rsOrdInfoGated.getString(5).length())
+ fillSpaces(8,rsOrdInfoGated.getString(6).length()) + rsOrdInfoGated.getString(6)
+ fillSpaces(10,rsOrdInfoGated.getString(7).length()) + rsOrdInfoGated.getString(7)
+ fillSpaces(12,rsOrdInfoGated.getString(8).length()) + rsOrdInfoGated.getString(8)
+ fillSpaces(10,rsOrdInfoGated.getString(9).length()) + rsOrdInfoGated.getString(9)
+ "\n\n";

Thanks in advance.

Regards,
Rajesh.
 
Jan Cumps
Bartender
Posts: 2588
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't counted , but not all drivers support that you call the getXXX() twice for the same column.
Why don't you temporary put each call on a separate line, so that the error will show which call is bogus?

I mean:

 
Jan Cumps
Bartender
Posts: 2588
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
... and welcome to the Ranch!
 
Rajesh Kumar Sm
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jan,

Thanks for your response, will try this out.

Regards,
Rajesh.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic