java.sql.SQLException:ORA-01747

时间:2012-04-24 14:58:41

标签: java sql oracle sqlexception

当我运行以下SQL查询时,我收到以下错误:

java.sql.SQLException: ORA-01747: invalid user.table.column, table.column, or column specification

String strQuery = "UPDATE themed_night SET theme_night_name = ?, theme_night_date = TO_DATE(?, 'dd-MM-yy'), theme_night_description = ?, WHERE theme_id = ?";
        PreparedStatement stmt = conn.prepareStatement(strQuery);//prepare the SQL Query
        stmt.setString(1, title);
        stmt.setString(2, output);
        stmt.setString(3, details);
        stmt.setString(4, themeID);

我的SQL查询语法是否正确?我仔细检查了列,并输入了正确的名称。

1 个答案:

答案 0 :(得分:3)

你的陈述中有一个额外的逗号。正确的陈述应该是

String strQuery = "UPDATE themed_night SET theme_night_name = ?, theme_night_date = TO_DATE(?, 'dd-MM-yy'), theme_night_description = ? WHERE theme_id = ?";

此外,您可能需要用单引号括起一些值(虽然我不确定)