-1

当我运行以下 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 查询语法是否正确?我已经仔细检查了这些列,并且输入了正确的名称。

4

1 回答 1

3

您的语句中有一个额外的逗号。正确的说法应该是

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

此外,您可能需要用单引号将一些值括起来(尽管我不确定)

于 2012-04-24T15:00:28.287 回答