473,399 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Why are we going for cursor, can't we use procedure instead?

Yes I know cursor is a private area where SQL commands are executed and we can use them for further use. Even the procedure is used to perform an action and it may or may not return a value. Also, i have heard that using cursor makes the process slow. Can anyone help me out on this?
Mar 11 '13 #1
7 1522
rski
700 Expert 512MB
Usually you use cursor for fetching data from tables. When you create procedure and you want to get some data from table you also have to create cursor, you do it explicite or implicite.
Mar 13 '13 #2
Rabbit
12,516 Expert Mod 8TB
Which one you use depends on the specifics of what you're trying to do. Since we have no specifics, there's no recommendations we can make.
Mar 13 '13 #3
Thanks for your response friends.

@rski--> Again my doubt is can't we use procedure to fetch data from the table, is cursor a necessary one to go?
Mar 14 '13 #4
rski
700 Expert 512MB
Even when you fetch data from table in procedure you use cursor ..
For example if you write
Expand|Select|Wrap|Line Numbers
  1. for v in (select ....) loop
  2. ...
  3. end loop;
  4.  
oracle defines cursor.
Mar 14 '13 #5
So oracle defines cursor by default is what i got..Is that rite rski..?
Mar 14 '13 #6
rski
700 Expert 512MB
You can define it explicite with CURSOR 'command' or implicite as I show in the example. In both oracle will create cursor
Mar 14 '13 #7
That was much helpful rski..

Thanks for your time..!!
Mar 14 '13 #8

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

Similar topics

15
by: Philip Mette | last post by:
I am begginner at best so I hope someone that is better can help. I have a stored procedure that updates a view that I wrote using 2 cursors.(Kind of a Inner Loop) I wrote it this way Because I...
18
by: Rhino | last post by:
I am having a problem with a nested SQL Procedure on DB2 V8.2.1 on Windows. This simple-looking proc is giving me this error message when I try to build it in the Development Center: ...
13
by: ken | last post by:
Hi, How can I get to the Procedure Attributes window? According to documentation its in the tools menu of the MS Access VB editor. I can't find it...its not there... I'm using Access 2000. ...
2
by: martinharvey via DotNetMonster.com | last post by:
This is probably a very simple question but i am having problems with a stored procedure syntax. I want to insert fields with preset values (DateCreated/OrderVerified) and two values (Name/...
4
by: martinharvey via DotNetMonster.com | last post by:
This is probably a very simple question but i am having problems with a stored procedure syntax. I want to insert into a Datatable ("Orders") "Name" and "Address" from a datatable called...
10
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...
5
by: Sebastian Moderlak | last post by:
Hello Folks, I tried to create a stored procedure on the AS/400 - but it doesn't work ;o( At first I will validate a specific value by a Param-value and after that update it. At least I want...
1
by: frankwu | last post by:
exam is coming.i still feel headache about procedure using cursor. here is example: Q.Create a cursor stored procedure called PriceChange to read the title id and price from the titles tables which...
1
by: andeke | last post by:
Hi! I'm developing a classic ASP application in which I'm supposed to retrieve a recordset from an Oracle procedure. The Oracleprocedure only has one parameter, an out parameter of type REF...
4
by: Snow | last post by:
Hello: I want to find that the ntext column data string have more than 2000 characters. I need to truncate those strings to the segments with 200 character, then put those segments along with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.