473,662 Members | 2,693 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_NA ME 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 1317
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_NA ME 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
1987
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 furnish values to python. This does not work MY PYTHON CODE IS: import adodbapi connStrSQLServer = r"Provider=SQLOLEDB.1; User ID=sa; Password=tester; Initial Catalog=someDB;Data Source=someSource" db = adodbapi.connect(connStrSQLServer)
0
1948
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 procedure and then I select from that dynamic table to furnish values to python. This does not work MY PYTHON CODE IS: import adodbapi connStrSQLServer = r"Provider=SQLOLEDB.1; User ID=sa; Password=tester; Initial Catalog=someDB;Data...
2
6829
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 ends with *INLR set on. The second time the program is called and the stored procedure is executed, the stored procedure bombs before it can return the cursor to the result set. In the job log we see: Space offset X'00000000' or teraspace...
11
4981
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, making it visible or not. Yep you guessed it, expanding tree type functionality. The header has an onclick event onclick='Doexpandcollapse
10
10883
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 1/10th. I tried to create a sql statement for "load from cursor cur insert into table name" using java stored procedure, but this isnt recognised by sql since load isnt a sql keyword. So whats the solution to this. I have to do it programatically...
7
6552
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 the post below, my question involves non-partitioned table loads. I want to know if, in general, loading from cursor is slower than loading from a file? I was thinking cursor would normally be faster, because of DB2's superior buffer/prefetch...
2
2621
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 other data. At the end the stored procedure cursor returns several data sets. my problem is that the report services appears to be reading only the data returned from the first loop of the cursor inside the stored procedure. It does not return the...
5
3481
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 the cursor was on in the datasheet at the time I executed the macro. So, the questions are: 1) In the macro, how to I get my hands on the record key or record data of the record the cursor was on in the datasheet at the time I executed the...
12
2184
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: -- Initialize the temp tables............ create procedure myschema.init_ebom_tables ( ) language sql
14
2888
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 statement. I first connect to the database... self.con = MySQLdb.connect(user=username, passwd =password) self.cursor = self.con.cursor() self.cursor.execute("SET max_error_count=0")
0
8435
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8857
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8768
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8547
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6186
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4181
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1754
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.