This discussion is archived
2 Replies Latest reply: Feb 2, 2013 5:05 AM by Etbin RSS

Type mismatch issue

ora_1978 Explorer
Currently Being Moderated
1) create package spec with two record type. Note : 1 attribute common in both the types

CREATE OR REPLACE PACKAGE gfstm_parm_test AS
TYPE g_rec_1 IS RECORD
(ship_type_flag varchar2(1),
reason_code_flag varchar2(1)
);
TYPE g_rec_2 IS RECORD
(ship_type_flag varchar2(1),
cost_by_supplier_flag varchar2(1)
);
end gfstm_parm_test ;
/


2) create procedure with one of the record type. i.e g_rec_1

create or replace procedure test_rec_type_pr(i_rec_var IN gfstm_parm_test.g_rec_1) is
begin
dbms_output.put_line(i_rec_var.ship_type_flag);
end;
/
--

3) execute the below block for g_rec_1 by calling procedure test_rec_type_pr
ans: works

Requirement: The same procedure WITHOUT ANY MODIFICATION to be used for the other type g_rec_2 as input parameter and should print 'a'. But getting type mismatch issues.

How to make it to work ?


declare

l_rec_1 gfstm_parm_test.g_rec_1;
l_rec_2 gfstm_parm_test.g_rec_2;

begin
l_rec_2.ship_type_flag := 'a';
test_rec_type_pr(l_rec_2);
end;
/

Thanks,
Vinodh

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points