Home » Developer & Programmer » Forms » CURSOR PROBLEM
CURSOR PROBLEM [message #133753] Mon, 22 August 2005 02:06 Go to next message
samit_gandhi
Messages: 226
Registered: July 2005
Location: Hong Kong
Senior Member

Dear

I have put following cursor in the program to get the records from the other table. This records are only for to display on the screen. I dont want to store it. But i am only getting a single record on the screen. I want all the records from the database.

declare
depcnt number;
cursor c1 IS SELECT stone_code,used_carat,used_diamond,size_of
FROM diamond_return_detail
WHERE design_no=:electro_polishing_return.design_no and counter=:electro_polishing_return.counter;
begin
select count(*)
into depcnt
from diamond_return_detail
WHERE design_no=:electro_polishing_return.design_no and counter=:electro_polishing_return.counter;
IF depcnt > 0 then
OPEN c1;
FIRST_RECORD;
LOOP
FETCH c1 into :stone_return.STONE_CODE,
:stone_return.USED_CARAT,
:stone_return.USED_DIAMOND,
:stone_return.SIZE_OF;
EXIT WHEN c1%NOTFOUND;
END LOOP;
END IF;
CLOSE c1;
end;

Please advise.

Samit Gandhi
Re: CURSOR PROBLEM [message #133756 is a reply to message #133753] Mon, 22 August 2005 02:12 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Samit,

Just define a block based on 'diamond_return_detail', put 'design_no=:electro_polishing_return.design_no and counter=:electro_polishing_return.counter' into the default_where and just let Oracle populate the table for you. You will have to do a 'go_block('diam_dtl')' and an 'execute_query' but that's all.

David
Re: CURSOR PROBLEM [message #133760 is a reply to message #133756] Mon, 22 August 2005 02:20 Go to previous messageGo to next message
samit_gandhi
Messages: 226
Registered: July 2005
Location: Hong Kong
Senior Member

when i am doing like your suggestion. it is hanged at saving the record of the above block. bcs there is a primary key constraint on the diamond_return_detail table.

please advise immediately
Re: CURSOR PROBLEM [message #133761 is a reply to message #133753] Mon, 22 August 2005 02:30 Go to previous messageGo to next message
kiran
Messages: 503
Registered: July 2000
Senior Member
Your question says that you just want to display the total records , now why are you trying to save the record.

--Kiran.
Re: CURSOR PROBLEM [message #133763 is a reply to message #133761] Mon, 22 August 2005 02:33 Go to previous messageGo to next message
samit_gandhi
Messages: 226
Registered: July 2005
Location: Hong Kong
Senior Member

there are two blocks i have created one block is a database block and other is for displaying the records only. The first block's data i have to save and other is for reference use.

this the senerio.

samit gandhi
Re: CURSOR PROBLEM [message #133934 is a reply to message #133763] Mon, 22 August 2005 17:18 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
I don't agree with your design but that is probably because I don't understand your objective or the data structure from which you are starting. That having been said, your loop is not going to the next record. Try issuing a 'down' or 'create_record' for your subsequent rows.

David

[Updated on: Mon, 22 August 2005 18:07]

Report message to a moderator

Re: CURSOR PROBLEM [message #133941 is a reply to message #133934] Mon, 22 August 2005 18:07 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Look at http://www.orafaq.com/forum/m/111031/67693/#msg_111302.

David
Previous Topic: forms books
Next Topic: Dynamic LOV issue in CUSTOM.pll
Goto Forum:
  


Current Time: Fri Sep 20 07:22:04 CDT 2024