I have run into a strange problem in an ALREADY WORKING code. There is a working procedure pkg_pbrer.p_gen_pbrer_rpt which returns v_po_report as an output cursor.
I am trying to capture this cursor into table_po_report_62 and this was working fine.
Now I am facing the error of
ORA-00932: inconsistent datatypes: expected - got -" in cursor fetch statement.
For simplicity of understanding, I have omitted the unnecessary lines of code.
DECLARE
v_po_report SYS_REFCURSOR;
TYPE type_po_report_62 IS RECORD (soc varchar2(1000), pt varchar2(1000), mp varchar2(1000),
blind varchar2(1000), ac varchar2(1000), placebo varchar2(1000));
table_po_report_62 type_po_report_62;
--
--
-- Some working code
--
--
-- Initializing Reference cursor
open v_po_report for 'select 1 from dual';
pkg_pbrer.p_gen_pbrer_rpt (v_user_id,v_report_type,v_report_form_id,v_reg_report_id,v_po_report,v_po_case_list);
LOOP
FETCH v_po_report INTO table_po_report_62;
-- Encountered ORA-00932: inconsistent datatypes: expected - got -
EXIT WHEN v_po_report%NOTFOUND;
insert into pbrer_output62_report (soc, pt, mp, blind, ac, placebo)
values (table_po_report_62.soc, table_po_report_62.pt, table_po_report_62.mp, table_po_report_62.blind, table_po_report_62.ac, table_po_report_62.placebo) ;
END LOOP;
CLOSE v_po_report;
EXCEPTION
WHEN OTHERS THEN
--
--
-- Some working code
--
--
END;
v_po_reportis a refcursor which points to a single row dataset with a single column value 1, i.e. NUMBER data type. While you are trying to fetch into a record type with a completely different structure. - Lalit Kumar B