#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    2
    Rep Power
    0

    Oracle types issue while migrating 10g to 11g


    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.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Posts
    179
    Rep Power
    28
    How about capitalizing the type name.
    Code:
    declare
    lps_test_type PS_TEST_TYPE;
    begin
        lps_test_type := NEW PS_TEST_TYPE('1');
        dbms_output.put_line(PS_TEST_TYPE.getId());
    end;
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    2
    Rep Power
    0
    Thanks for the reply imchi, I tried as you suggested but ended with same error.

    The posted sample code is working in 11.1.0.2 version.

    I still not find the solution in version 11.2.0.3.0.

    Thanks
    tgolla

IMN logo majestic logo threadwatch logo seochat tools logo