简体   繁体   English

错误 java.sql.SQLException: ORA-01722: 运行准备好的语句以更改序列时数字无效

[英]ERROR java.sql.SQLException: ORA-01722: invalid number while running a Prepared Statement to alter a Sequence

sqlStmt = new StringBuffer("  ALTER SEQUENCE "  );  
                    sqlStmt.append( ServerContext.getSchemaName() );
                    sqlStmt.append("SEQ_EDCD_TRACE_NUM");
                    sqlStmt.append( " INCREMENT BY " );
                    sqlStmt.append( " ? " );
pstmt.setLong(1, incval);
pstmt.execute();

You can't use bind variables with DDL, such as ALTER SEQUENCE .您不能将绑定变量与 DDL 一起使用,例如ALTER SEQUENCE You'll have to concatenate incval onto the string.您必须将incval连接到字符串上。

There shouldn't be any risk of SQL injection if incval is an int or a long .如果incvalintlong ,则不应存在 SQL 注入的任何风险。

暂无
暂无

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

相关问题 stmt.executeUpdate()返回java.sql.SQLException:ORA-01722:无效的数字 - stmt.executeUpdate() returns java.sql.SQLException: ORA-01722: invalid number 错误 --> java.sql.SQLSyntaxErrorException: ORA-01722: 无效号码 - ERROR --> java.sql.SQLSyntaxErrorException: ORA-01722: invalid number java.sql.SQLSyntaxErrorException-ORA-01722: 无效数字 - 准备好的语句 - java.sql.SQLSyntaxErrorException-ORA-01722: invalid number - Prepared statement java.sql.SQLSyntaxErrorException:ORA-01722:refcursor上的resultSet.next()时数字无效,我不明白为什么? - java.sql.SQLSyntaxErrorException: ORA-01722: invalid number while resultSet.next() on refcursor and I don't understand why? 在准备语句中执行 IN 子句时出现无效数字异常(ORA-01722) - invalid number exception(ORA-01722) while executing IN clause in preparedstatement java.sql.SQLException: ORA-01465: 无效的十六进制数 - java.sql.SQLException: ORA-01465: invalid hex number setRepositoryConnection中的错误:java.sql.SQLException:ORA-00900:无效的SQL语句 - Error in setRepositoryConnection : java.sql.SQLException: ORA-00900: invalid SQL statement Hibernate Map抛出 - ORA-01722:无效的数字错误 - Hibernate Map throws - ORA-01722: invalid number error java.sql.SQLSyntaxErrorException:ORA-01722:number_where IN无效 - java.sql.SQLSyntaxErrorException: ORA-01722: invalid number_where IN 问题休眠(java.sql.SQLSyntaxErrorException:ORA-01722:无效的数字) - Issue hibernate (java.sql.SQLSyntaxErrorException: ORA-01722: invalid number)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM