简体   繁体   English

java.sql.SQLException:ORA-01747

[英]java.sql.SQLException: ORA-01747

When i am running the following SQL query i am getting the following error: 当我运行以下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);

Is my SQL query syntax correct? 我的SQL查询语法正确吗? I have double checked the columns and i have typed the correct names. 我仔细检查了列,并输入了正确的名称。

You have an extra comma in your statement. 语句中有一个逗号。 The correct statement should be 正确的陈述应该是

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

Also, you might need to enclose some values with single quotes (though I'm not sure about that) 另外,您可能需要将一些值括在单引号中(尽管我不确定)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM