How to use Varchar2 Varible with Cursor Parameter [message #320130] |
Wed, 14 May 2008 02:55 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
brijal_j_patel
Messages: 28 Registered: May 2007 Location: Surat,India
|
Junior Member |
|
|
Hello Gurus,
In my form, I have a cursor with v1(Varchar2) Parameter. This cursor use this parameter in where field1 in (v1)
Cursor c1(v1 varchar2)
is
select empid,empname
from emp
where dept in (v1);
Can anybody tell how to pass values in v1, as
I tried following
'ABC','PQR'
but it will give me no record found message. There is 3 records with dept='ABC' and 4 records with dept='PQR'. dept field is of varchar2(10).
I tried in sqlplusw and it work fine. But it is not working in Form 6i.
Please help me
Regards
Brijal
Upd mod: Text from second message which I have deleted.
[Updated on: Wed, 14 May 2008 03:09] by Moderator Report message to a moderator
|
|
|
|
|
Re: How to use Varchar2 Varible with Cursor Parameter [message #320170 is a reply to message #320140] |
Wed, 14 May 2008 04:17 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
brijal_j_patel
Messages: 28 Registered: May 2007 Location: Surat,India
|
Junior Member |
|
|
Martin Sir,
Floowing code is placed in cntrl block's "Search Emp" button.
declare
cursor c1(v1 varchar2) is
select empcode,empname
from emp
where dept in (v1);
v2 varchar2(2000);
begin
go_block('dept');
first_record;
if :dept.recSel='Y' then
v2:=''''||v1||'''';
end if;
loop
next_record;
exit when :system.last_record='TRUE';
if :dept.recSel='Y' then
if v2 is null then
v2:=''''||v1||'''';
else
v2:=v2||','''||v1||'''';
end if;
end if;
end loop;
first_record;
go_block('emp');
clear_block;
for rec in c1(v2)
loop
create_record;
:emp.empname:=rec.empcode;
:emp.empname:=rec.empname;
end loop;
first_record;
end;
Regards
Brijal
|
|
|
|
|
|
|