This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi Pals, i have a class which contains my SQL strings for select and insert.... This class is used in my JSP to run a query / insert via a Database+JDBC class.My problems are: 1.after successfully inserting some records into my oracle db (table) and did a select to confirm the insert ,i still get this error on my Tomcat window: java.sql.SQLException: ORA-00900:invalid SQL statement 2.If i have a field as NUMBER on my database table .What effect does this have : inserting a Java type of "898"(a stringified number) in my insert statement as long as i donot have it in single quotes in my VALUES(.....) clause please help;
1. Slightly confused: Are you getting the error from the Insert or on the Select? Remember that an Insert does not return a ResultSet Object, and I've gotten this error when I have tried to get one from an Insert/Update. You can however, get the number of effected rows by using something like this: stmt = Connection.createStatement(); rowsAffected = stmt.executeUpdate(YourSQLQuery);
2. There shouldnt be a problem with it becauase by the time the statement hit Oracle, the String has been parsed already. What happens when you try? :] HTH;
what is the offending SQL/DML statement that throws the exception? Jamie
Joined: Oct 17, 2001
Big Cheers Kenneth & Jamie, 1.Ora 900 : Invalid SQL Statement.I did something stupid,i was doing this: statementRef.executeUpdate("commit"); trying to commit update using the statement above which is absolutely wrong. The right way is: connectionRef.commit(); since commit()is a method of the connection object. 2.inserting "2323" using executeUpdate("sqlString") worked fine no errors Thaks guys.