2 Replies Latest reply: Apr 3, 2013 1:00 AM by 908002 RSS

    ORA-00932: inconsistent datatypes:  ( oracle 11g r2)

    908002
      Below is the sample code working fine in 10g and not working now in 11g.
       
      CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "PSTest" AS
      import java.sql.SQLData;
      import java.sql.SQLException;
      import java.sql.SQLInput;
      import java.sql.SQLOutput;
      import java.util.List;
       
      public class PSTest implements SQLData{
       
      public String sql_type = "PS_TEST_TYPE";
       
      private String id;
       
      public PSTest(){
      super();
      }
       
      public String getId() throws java.sql.SQLException{
      return id;
      }
       
      public void setId(String id) throws java.sql.SQLException{
      this.id = id;
      }
      public String toString() {
      StringBuffer sb = new StringBuffer(this.getClass().getName());
      return sb.toString();
      }
      public String getSQLTypeName() throws SQLException {
      return sql_type;
      }
      public void writeSQL(SQLOutput stream) throws SQLException {
       
      stream.writeString(id);
      }
      public void readSQL(SQLInput stream, String typeName) throws SQLException {
      sql_type = typeName;
      id = stream.readString();
      }
       
      }
      / 
       
      and then we have created type as below:
       
      CREATE OR REPLACE TYPE ps_test_type as object external name 'PSTest' language java
      using sqldata(
      id varchar2(1000) external name 'id',
      member function getId return varchar2 external name 'getId() return java.lang.String'
      );
      / 
       
      when we test the above created type object from anonymous block,
       
      declare
      lps_test_type ps_test_type;
      begin
      lps_test_type := NEW ps_test_type('1');
      dbms_output.put_line(lps_test_type.getId());
      end;
       
      we got the below error:
      ORA-00932: inconsistent datatypes: expected an IN argument at position 1 that is an instance of an Oracle type convertible to an instance of a user defined Java class 
      got an Oracle type that could not be converted to a java class
       
      Current Oracle version is Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit
      and the version we are upgrading is Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit
       
      Thanks in advance for all the help.