Home » SQL & PL/SQL » SQL & PL/SQL » Type object declaration for cur% rowtype (oracle 9i)
Type object declaration for cur% rowtype [message #320480] Thu, 15 May 2008 04:27 Go to next message
saurav.raj
Messages: 8
Registered: May 2008
Location: BANGALORE
Junior Member

Hi

i m not getting the correct syntax for Type object declaration for cur% rowtype...
please mention the correct syntax of the following procedure.........

declare
cursor temp2_cur is select id ,name,age from temp;
type src_cur is table of temp2_cur%rowtype ;
tar_id src_cur.id;
tar_name src_cur.name;
tar_age src_cur.age;
begin
open temp2_cur;
loop
fetch temp2_cur bulk collect into tar_id,tar_name,tar_age limit 10000;
forall p_rec_count in tar_cur.id.first..id.last
insert into temp2 (id,name,age)
values(tar_id(p_rec_count),tar_name(p_rec_count),tar_age(p_rec_count));
exit when temp2_cur%NOTFOUND;
end loop;
commit;
close temp2_cur;
end;
Re: Type object declaration for cur% rowtype [message #320481 is a reply to message #320480] Thu, 15 May 2008 04:30 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
And the error you're getting is.......?
Re: Type object declaration for cur% rowtype [message #320483 is a reply to message #320480] Thu, 15 May 2008 04:34 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You have to declare a table type for each field of cursor.

Regards
Michel
Re: Type object declaration for cur% rowtype [message #320484 is a reply to message #320480] Thu, 15 May 2008 04:36 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Read the following current and concurrent topic:
http://www.orafaq.com/forum/t/118840/102589/

Regards
Michel

Previous Topic: Need Only Numbers
Next Topic: Using bulk collect and forall syntax in the procedure
Goto Forum:
  


Current Time: Sun Dec 04 04:46:30 CST 2016

Total time taken to generate the page: 0.22544 seconds