I've been trying out the following code, as I was having problems in my own code with a similar implementation. Why do I receive the error "ORA-00932: inconsistent datatypes: expected CHAR got REF SQL_CTACWAZJUEYWUEKVFEHCWNTZQ.TABLE1_TYPE" when executing the "Select REF" query. I expect "[TST.TABLE1_TYPE]" to be displayed. I'm currently using Oracle Live SQL.

Create or replace type table1_Type as object (
 id integer,
 dateStart date,
 etc varchar2(20));
-- TYPE TABLE1_TYPE compiled

create table table1 of table1_type;
-- table TABLE1 created.

Create or replace type table2_type as object(
 id integer,
 items varchar2(30),
 datePurchased varchar2(20),
 table1_Ref REF table1_type);
-- TYPE TABLE2_TYPE compiled

create table table2 of table2_type;
--table TABLE2 created.

INSERT INTO table1 VALUES(table1_Type(1, SYSDATE, 'etc1...'));
INSERT INTO table1 VALUES(table1_Type(2, SYSDATE, 'etc2...'));

SELECT  REF(t)
FROM    table1 t
WHERE   id = 1;

0 Answers