Home » Developer & Programmer » Forms » Cursor Problem
Cursor Problem [message #472600] Sun, 22 August 2010 23:53 Go to next message
samit_gandhi
Messages: 226
Registered: July 2005
Location: Hong Kong
Senior Member

Hi

I want to fetch the data through the cursor and cursor is getting the value of group_code through the variable 'a'. but when i am writing the code like this it is not coming.
Please suggest

My code is like this :

declare
        a varchar2(400):='';
	cursor c1 is select ref_no,ref_code,company_id from stock_detail where company_id=:global.company_id
	and group_code in (a);
begin
	go_block('group_master');
	first_record;
	loop
		if :group_master.select = 0 then
			if a is null then
				a:=:group_master.category_code;
			else				
				a:=a||','||:group_master.category_code;
			end if;
		end if;
		exit when :system.last_record='TRUE';
		next_record;
	end loop;
	if a ='' then
		null;
	else
		a:=a;
		go_item('group_master.A');
	end if;
	go_block('stock_fare_detail');
	open c1;
	loop
		fetch c1 into :stock_fare_detail.ref_no,:stock_fare_detail.ref_code,:stock_fare_detail.company_id;
		exit when c1%notfound;
		next_record;
	end loop;
	close c1;
end;
Re: Cursor Problem [message #472635 is a reply to message #472600] Mon, 23 August 2010 02:08 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Variable in-list

You should also note that in oracle
''
is the same as
null
So this:
if a ='' then
is the same as this:
if a=null then
which is never true.
It should be:
if a is null then

Re: Cursor Problem [message #472649 is a reply to message #472635] Mon, 23 August 2010 02:49 Go to previous message
samit_gandhi
Messages: 226
Registered: July 2005
Location: Hong Kong
Senior Member

I solved the problem

the soloution is here :

http://www.oracledba.co.uk/tips/collections.htm

thanks


Previous Topic: text item in Oracle forms
Next Topic: frm-41084 Error getting Group Cell.
Goto Forum:
  


Current Time: Fri Sep 20 06:37:19 CDT 2024