This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Oracle/OAS and the fly likes ORA-01008: not all variables bound Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Reply Bookmark "ORA-01008: not all variables bound" Watch "ORA-01008: not all variables bound" New topic
Author

ORA-01008: not all variables bound

Shanmugam Muthukumarasamy
Ranch Hand

Joined: Jan 11, 2003
Posts: 83
Hi All,
In my application, at runtime, I am getting the following exception:
Description: Class: FdpMbrDatesData Method: executeQuery() : SQLException
java.sql.SQLException: ORA-01008: not all variables bound
I am not able to guess what is the problem with the following portion of the code.
pstmt = rO_conn.prepareStatement(lS_SQLStatement);
pstmt = this.setBindParams(pstmt);
int ii_position = 1;
//set timestamp of query; Take stamp before query as this is the most conservative view
super.setSQLDateTimeStamp(new java.util.Date());
rs = pstmt.executeQuery();

While crossing the "pstmt.executeQuery()" it is throwing the above exception.
It is very Urgent...If any body have any idea please let me know.
Thanks in advance,
Shanmugam.
[ January 20, 2003: Message edited by: Mark Spritzler ]

SJCP 1.4<br />SCWCD 1.4<br />SCEA
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17234
    
    1

Not all variables bound. Where in your code do you actually set your bind variables. I don't quite see it assigned. I see one statement "pstmt = this.setBindParams(pstmt);" which looks to try to set them, but pstmt is the statement not the values.
I could be wrong here, but that is my impression. I have worked with prepared statements in JDBC and in VB Command Objects, and usually there are assignment statements like

statement = "Select * from a_table where field_a = :bind_var1"
Then you have a statement that is similar, but in psuedo-code here:
statement.setBind(bind_var1, "My Value")
something along those ines, I don't remember code by heart here, but it would be something similar.
Am I missing anything? Am I completely off base?
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Shanmugam Muthukumarasamy
Ranch Hand

Joined: Jan 11, 2003
Posts: 83
Thanks Mark !!! I will try ....
Shanmugam.
Dan Nuttle
Greenhorn

Joined: Sep 24, 2003
Posts: 2
This is an old thread, but I thought I'd throw something in, in case anyone else runs into the same problem. I just got the same error, and I was stumped for a couple of minutes. My SQL statement looks something like this:

SELECT FIELD1, FIELD2
FROM TABLE1
WHERE FIELD1=?

I set the parameter:

ps.setString(1, "Value")

And yet I still got this error about not binding variables. Huh? So I took a closer look at the code, and I noticed this:

ResultSet rs = ps.executeQuery(sql)

Oops! The sql had already been set when I created the PreparedStatement. By passing it in again at time of execution, I effectively wiped out the parameter I'd already set. This happened because I was refactoring some old code, and changing Statements to PreparedStatements.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ORA-01008: not all variables bound
 
Similar Threads
Urgent !!! Prepared Statement Problem
ORA-01008: not all variables bound
java.sql.SQLException: ORA-01008: not all variables bound
Prepared Statement Problem
what is "ora-01008:not all variables bound"