drop table tab1 purge;
create table tab1 (vendor char(1));
insert into tab1 values('A');
insert into tab1 values('B');
insert into tab1 values('D');
commit;
create or replace procedure myProc (p_filter in char, p_vendcode in char)
is
my_var varchar2(100);
myCur sys_refcursor;
myResult char(1);
begin
My_var := 'select vendor from tab1 where vendor like decode( ''' || p_filter || ''',''A'',''%'',''F'', ''' || p_vendcode|| ''')';
open myCur for my_var;
fetch myCur into myResult;
dbms_output.put_line('got: ' || myResult);
close myCur;
end;
/
exec myProc('A','B');
exec myProc('F','D');
|