错误 java.sql.SQLException: ORA-01722: 运行准备语句来更改序列时数字无效
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();
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();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能将绑定变量与 DDL 一起使用,例如
ALTER SEQUENCE
。您必须将incval
连接到字符串上。如果
incval
是int
或long
,则不应存在任何 SQL 注入风险。You can't use bind variables with DDL, such as
ALTER SEQUENCE
. You'll have to concatenateincval
onto the string.There shouldn't be any risk of SQL injection if
incval
is anint
or along
.