469,072 Members | 1,838 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,072 developers. It's quick & easy.

From cursor to a table

151 100+
Hi All


Recently i was working on cursors in a procedure. I was using a cursor in a procedure to retrieve names and corresponding Ids. I used loop to fetch each record into an OUT variable. But I want all the names to be directly stored into a temporary table(created by myself, which has only one field for storing the names). I want to use this temporary table later at the front end application.


this was my code snippet
------------------------------------------------------------------------------------------------
CREATE Procedure HRMS ( id out varchar2,name out varchar2 )
IS
cursor c1 is
select PROJ_Id,LAST_NAME from HRMS_TABLE where LAST_name LIKE s%;
BEGIN
open c1;
LOOP
fetch c1 into ID,NAME;
exit when c1%NOTFOUND;
END LOOP;
close c1;
end;
----------------------------------------------------------------------------------------------
Please someone help regarding this. I hope i get an Reply for this as soon as possible.

Thank u
Jun 21 '07 #1
4 1199
r035198x
13,262 8TB
Hi All


Recently i was working on cursors in a procedure. I was using a cursor in a procedure to retrieve names and corresponding Ids. I used loop to fetch each record into an OUT variable. But I want all the names to be directly stored into a temporary table(created by myself, which has only one field for storing the names). I want to use this temporary table later at the front end application.


this was my code snippet
------------------------------------------------------------------------------------------------
CREATE Procedure HRMS ( id out varchar2,name out varchar2 )
IS
cursor c1 is
select PROJ_Id,LAST_NAME from HRMS_TABLE where LAST_name LIKE s%;
BEGIN
open c1;
LOOP
fetch c1 into ID,NAME;
exit when c1%NOTFOUND;
END LOOP;
close c1;
end;
----------------------------------------------------------------------------------------------
Please someone help regarding this. I hope i get an Reply for this as soon as possible.

Thank u
If I got your question right, then all you need to do is to put the insert statement between the fetch line and the exit when line. Are you having problems with the insert statement?
Jun 21 '07 #2
debasisdas
8,127 Expert 4TB
Please find more details regarding cursors here.
Jun 21 '07 #3
vamsioracle
151 100+
Please find more details regarding cursors here.



thank you very much. That was a timely help
Jun 21 '07 #4
debasisdas
8,127 Expert 4TB
Hi
vamsioracle
Welcome to TSDN.

You have reached the right place for knowledge shairing.

Here you will find a vast resource of related topics and code.

Feel free to post more doubts/questions in the forum.

But before that give a try from your side and if possible try to post what/how you have approached to solve the problem.

It will help Experts in the forum in solving/underestanding your problem in a better way.

Please follow the posting guidelines in every new post/reply.

Regards

Debasis
Jun 21 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Golawala, Moiz M (GE Infrastructure) | last post: by
reply views Thread by Golawala, Moiz M (GE Infrastructure) | last post: by
2 posts views Thread by Dan Flynn | last post: by
11 posts views Thread by trinitypete | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.