wood burning stoves 2.0*
The moose likes JDBC and the fly likes Suddenly getting the exception ORA-22816: unsupported feature with RETURNING clause Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Suddenly getting the exception ORA-22816: unsupported feature with RETURNING clause" Watch "Suddenly getting the exception ORA-22816: unsupported feature with RETURNING clause" New topic
Author

Suddenly getting the exception ORA-22816: unsupported feature with RETURNING clause

bilal haider
Ranch Hand

Joined: Feb 08, 2011
Posts: 47

I am inserting a record in remote table using foolowing code.


Exception:
java.sql.SQLException: ORA-22816: unsupported feature with RETURNING clause

at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:206)
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:1034)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:953)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1222)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3387)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3468)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1350)
at org.hms.pocdatasync.ui.bean.Test.testPush(Test.java:219)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:91)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

What can be the problem? I am using Oracle 11.2.0 on my local machine. Can this be an issue that My Remote DB is not of same version i.e Oracle version issue on the two machines.
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

Oracle's error codes are really easy to look up: http://ora-22816.ora-code.com/

RETURNING clause is currently not supported for object type columns, LONG columns, remote tables, INSERT with subquery, and INSTEAD OF Triggers.

So no luck.

My advice would be to create a function on the remote side which would do the insert and return the generated ID. It could then be called even remotely.
bilal haider
Ranch Hand

Joined: Feb 08, 2011
Posts: 47

Restrictions apply to the RETURNING clause:
You cannot use this clause with parallel DML or with remote objects(dblink).
You cannot retrieve LONG types with this clause.

Now i have achieved the task by first getting sequence.nextval@Dblink and then passing it in insert,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Suddenly getting the exception ORA-22816: unsupported feature with RETURNING clause