获取序列ID时出现的异常,检查oracle数据库表ID字段类型是否为NUMBER类型。如果是long修改为number即可。 有关number类型:Http://www.blogjava.net/caoji
获取序列ID时出现的异常,检查oracle数据库表ID字段类型是否为NUMBER类型。如果是long修改为number即可。
有关number类型:Http://www.blogjava.net/caojianhua/arcHive/2011/01/24/343461.html
严重: null
java.sql.SQLException: ORA-22816: RETURNING 子句不支持的功能
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:110)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:171)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1030)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:947)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1222)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3381)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3462)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1061)
at org.iie.dao.impl.OracleGenelDaoImpl.insertDataReturnKeyByReturnInto(OracleGenelDaoImpl.java:160)
at org.iie.dao.impl.OracleGenelDaoImpl.main(OracleGenelDaoImpl.java:148)
顺便贴出获取序列号的方法:
public static int insertDataReturnKeyByReturnInto() throws Exception {
Connection conn = GlobalData.getOracleConnection();
String vsql = "insert into xx(id) values(xx_squencee.nextval) returning id into :1";
OraclePreparedStatement pstmt = (OraclePreparedStatement) conn.prepareStatement(vsql);
pstmt.reGISterReturnParameter(1, Types.BIGINT);
pstmt.executeUpdate();
ResultSet rs = pstmt.getReturnResultSet();
rs.next();
int id = rs.getInt(1);
rs.close();
pstmt.close();
System.out.print("id:" + id);
return id;
}
--结束END--
本文标题: ORACLE异常:RETURNING 子句不支持的功能
本文链接: https://lsjlt.com/news/44590.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0