Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Prepared statment executeQuery() error.

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have the following query in a class, and when this class hits the line ps.executeQuery() I get an exception which says " ORA-01006: bind variable does not exist "

I have been trying to work towards different solutions but i do not understand why the ps.executeQuery fails ? does it have anything to do with the nested queries ? Can I have an inline query and the " ps.setString(1, monthYear);ps.setString(2, monthYear);ps.setString(3, monthYear); " can still substitute the values in the inside query ?

Could some one help me out ?
 
author & internet detective
Posts: 40002
808
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've added code tags to make it more readable.

I only see 3 "?" bind variables in the query. How does the fourth one fit in?
 
Karthik Krishna
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry Jeanne

I am just mimicking a situation which I am encountering and for a few reasons I cannot copy paste the code in here so I am just replicating the issue in here.
You could just comment out the following from line 77 through 80.


# if (!fId.equals("91"))
# {
# ps.setString(4, fId);
# }

And another tiny correction line 38 is missing a bracket.
 
What do you have to say for yourself? Hmmm? Anything? And you call yourself a tiny ad.
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic