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 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.
Member Avatar for LastMitch

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

Does this code works in

Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit

or this:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit

Another words when you make the connection which database did you used?

Thanks for the reply. The sample code is working in 10.2.0.5.0 - 64bit but not working in 11.2.0.3.0 - 64bit(Server-Windows 2008 R2)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.