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.
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 ]
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
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:
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.