Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

ORACLE exception: a feature not supported by the RETURNING clause

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Get the exception that occurs while getting the sequence ID and check whether the ID field type of the oracle database table is of type NUMBER. If it is long, you can change it to number. About number types: features not supported by http://www.blogjava.net/caojianhua/archive/2011/01/24/343461.html severe: nulljava.sql.SQLException: ORA-22816: RETURNING clause 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)

By the way, post the method of obtaining the serial number:

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;}

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report