Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQLException:ORA-00928: missing SELECT keyword

843859Jun 4 2007 — edited Jun 4 2007
Hi,
I am trying to do a database insert using PreparedStatements. Following is the piece of code I'm executing.

StringBuffer query = new StringBuffer();
query.append("INSERT INTO" + TABLENAME);
query.append("VALUES");
query.append("(?,?,?,?,?,?,?,?,?,?)");
PreparedStatement pstatement = connection.prepareStatement(query.toString());

Date dt = new java.sql.Date(lCapacityDailyVO.getDateTime().getTime().getTime());


pstatement.setDate(1,dt);
pstatement.setString(2,lCapacityDailyVO.getMetricName());
pstatement.setString(3,lCapacityDailyVO.getKpi_Desc());
pstatement.setLong(4,lCapacityDailyVO.getKpi_Value());
pstatement.setLong(5,lCapacityDailyVO.getKpi_Ceiling());
pstatement.setString(6,lCapacityDailyVO.getUnits());
pstatement.setLong(7,lCapacityDailyVO.getUtilization());
pstatement.setString(8,lCapacityDailyVO.getPlatform());
pstatement.setString(9,lCapacityDailyVO.getSubComponent());
pstatement.setString(10,lCapacityDailyVO.getEnv());

res = pstatement.executeUpdate();
connection.close();

While executing this code I'm getting the following SQLException. I cannot understand why.

java.sql.SQLException: ORA-00928: missing SELECT keyword

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:579)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1894)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1094)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2132)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:2015)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2877)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:608)
at com.bigpond.opt.dao.OracleCapacityDailyDao.insert(OracleCapacityDailyDao.java:87)
at com.bigpond.opt.PerformanceDataGenerator.processAndPersistData(PerformanceDataGenerator.java:157)
Output is:0
at com.bigpond.opt.PerformanceDataGenerator.main(PerformanceDataGenerator.java:117)


Please help.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 2 2007
Added on Jun 4 2007
2 comments
1,593 views