473,508 Members | 2,110 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

From cursor to a table

151 New Member
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 1312
r035198x
13,262 MVP
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 Recognized Expert Expert
Please find more details regarding cursors here.
Jun 21 '07 #3
vamsioracle
151 New Member
Please find more details regarding cursors here.



thank you very much. That was a timely help
Jun 21 '07 #4
debasisdas
8,127 Recognized Expert Expert
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

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

Similar topics

0
1961
by: Golawala, Moiz M (GE Infrastructure) | last post by:
Hi All, I am having problem returning values from a Stored Procedure that creates a dynamic table (table variable) inserts values during a procedure and then I select from that dynamic table to...
0
1932
by: Golawala, Moiz M (GE Infrastructure) | last post by:
Hi All, Could someone please help me with an issue I am having. I am having problem returning values from a Stored Procedure that creates a dynamic table (table variable) inserts values during a...
2
6817
by: Dan Flynn | last post by:
We have a stored procedure that returns a result set. We call this stored procedure from an RPG program using SQL CLI. The first call is successful and we can fetch rows, etc. The RPG program...
11
4961
by: trinitypete | last post by:
Hi all, I have a user control that uses control literal to build a heading with a link, and a div containing links below. As the link heading is hit, I want to change the style of the div,...
10
10862
by: technocrat | last post by:
Hi, I am trying to declare and cursor and thn load from that cursor into another table. Since I have almost 4 million records, I cant do it without the cursor which reduces the time by almost...
7
6520
by: P. Adhia | last post by:
Sorry for quoting an old post and probably I am reading out of context so my concern is unfounded. But I would appreciate if I can get someone or Serge to confirm. Also unlike the question asked in...
2
2602
by: andres | last post by:
hi all, thanks for everyone for your support! i have a report being built in studio 2005. It calls a stored procedure. The SP runs a query and gets a data set which then loops through to get...
5
3473
by: Bill | last post by:
This database has no forms. I am viewing an Access table in datasheet view. I'd like to execute a macro to execute a function (using "runcode"). In the function, I'll reading data from the record...
12
2162
by: robertino | last post by:
Hi all, I've put together a few SPs to produce a BOM (bill of materials) listing, which together use a couple of global temp tables, and return the results from a cursor. Here's the code: ...
14
2875
by: Ben | last post by:
I don't know whether anyone can help, but I have an odd problem. I have a PSP (Spyce) script that makes many calls to populate a database. They all work without any problem except for one...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7326
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7385
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7498
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3195
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1558
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.