2 Replies Latest reply on Oct 26, 2011 10:04 AM by 709779

    java update exception because of mising comma


      Just go through the following statement

      stmt.executeUpdate("INSERT INTO STOCK_COMMENT" +
      "VALUES (" +
      "to_date(to_char(to_date(sysdate-1), 'DD-MON-YYYY-')||'" + dt +"', 'DD-MON-YYYY-HH:MI PM'),'"
      + cmt + "')");

      dt and cmt have following values

      dt : 8:43 AM
      cmt : In the next few days the market is likely to stay within a narrow range of 5030 and 5177, says Pankaj Jain of Satguru Capital on Zee Business. The bias is still positive and the market could open half a percent up at 5098, he adds. Buy Nifty with a target of 5182 and stop loss of 5079 or at 5015, he advises.

      Can anybody tell me why the following exception about missing of ',' is thrown

      java.sql.SQLException: [Oracle][ODBC][Ora]ORA-00917: missing comma
      at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
      at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
      at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
      at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
      at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unknown Source)
      at UpdateTable.updateIntoTable(UpdateTable.java:36)
      at CallbackHandler.show_line(CallbackHandler.java:106)
      at CallbackHandler.handleSimpleTag(CallbackHandler.java:76)
      at javax.swing.text.html.parser.DocumentParser.handleEmptyTag(Unknown Source)
      at javax.swing.text.html.parser.Parser.startTag(Unknown Source)
      at javax.swing.text.html.parser.Parser.parseTag(Unknown Source)
      at javax.swing.text.html.parser.Parser.parseContent(Unknown Source)
      at javax.swing.text.html.parser.Parser.parse(Unknown Source)
      at javax.swing.text.html.parser.DocumentParser.parse(Unknown Source)
      at Main.main(Main.java:29)