ORA-00932: inconsistent datatypes: [message #581061] |
Mon, 01 April 2013 07:11 |
|
tgolla
Messages: 3 Registered: April 2013
|
Junior Member |
|
|
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.
[mod-edit: code tags added by bb; next time please add them yourself]
[Updated on: Mon, 01 April 2013 10:59] by Moderator Report message to a moderator
|
|
|
Re: ORA-00932: inconsistent datatypes: [message #581063 is a reply to message #581061] |
Mon, 01 April 2013 07:14 |
|
Michel Cadot
Messages: 68731 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
SQL> declare
2 lps_test_type PS_TEST_TYPE;
3 begin
4 lps_test_type := NEW PS_TEST_TYPE('1');
5 dbms_output.put_line(lps_test_type.getId());
6 end;
7 /
1
PL/SQL procedure successfully completed.
SQL> @v
Version Oracle : 10.2.0.4.0
SQL> declare
2 lps_test_type PS_TEST_TYPE;
3 begin
4 lps_test_type := NEW PS_TEST_TYPE('1');
5 dbms_output.put_line(lps_test_type.getId());
6 end;
7 /
1
PL/SQL procedure successfully completed.
SQL> @v
Version Oracle : 11.2.0.1.0
Regards
Michel
[Updated on: Mon, 01 April 2013 08:49] Report message to a moderator
|
|
|
|
|
Re: ORA-00932: inconsistent datatypes: [message #581073 is a reply to message #581071] |
Mon, 01 April 2013 09:09 |
|
tgolla
Messages: 3 Registered: April 2013
|
Junior Member |
|
|
I created Java source, Oracle type and ran the anonymous block from SQLPlus as below and pasted the hole session:
C:\Users\Administrator>sqlplus poctest/poctest
SQL*Plus: Release 11.2.0.3.0 Production on Mon Apr 1 19:31:37 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "PSTest" AS
2 import java.sql.SQLData;
3 import java.sql.SQLException;
4 import java.sql.SQLInput;
5 import java.sql.SQLOutput;
6 import java.util.List;
7
8 public class PSTest implements SQLData{
9
10 public String sql_type = "PS_TEST_TYPE";
11
12 private String id;
13
14 public String getId() throws java.sql.SQLException{
15 return id;
16 }
17
18 public void setId(String id) throws java.sql.SQLException{
19 this.id = id;
20 }
21 public String toString() {
22 StringBuffer sb = new StringBuffer(this.getClass().getName());
23 return sb.toString();
24 }
25 public String getSQLTypeName() throws SQLException {
26 return sql_type;
27 }
28 public void writeSQL(SQLOutput stream) throws SQLException {
29
30 stream.writeString(id);
31 }
32 public void readSQL(SQLInput stream, String typeName) throws SQLExceptio
n {
33 sql_type = typeName;
34 id = stream.readString();
35 }
36
37 }
38 /
Java created.
SQL> CREATE OR REPLACE TYPE PS_TEST_TYPE as object external name 'PSTest' langua
ge java
2 using sqldata(
3 id varchar2(1000) external name 'id',
4 member function getId return varchar2 external name
'getId() return java.lang.String'
5 );
6 /
Type created.
SQL> declare
2 lps_test_type PS_TEST_TYPE;
3 begin
4 lps_test_type := NEW PS_TEST_TYPE('1');
5 dbms_output.put_line(lps_test_type.getId());
6 end;
7 /
declare
*
ERROR at line 1:
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
|
|
|