difference between cursor and procedure in a package

Answers were Sorted based on User's Feedback



difference between cursor and procedure in a package..

Answer / avi007

cursor-
1 cursor is small memory area to perform selection on the
one or more table.
2 cursor is a variable which is 2 dimentional array, it is
handling, storing and processin multiple rows.
3 storing data temporarily.
4 fetching rows from top to bottom.
5 fetching row one at a time.

procedure -
1 procedure is an object of database.
2 need to compile and execute.
3 dml operation performed in the block.

Is This Answer Correct ?    33 Yes 5 No

difference between cursor and procedure in a package..

Answer / vaibhavi_dixit

Whenever a statement is send by user to Oracle server for
execution, a memory is allocated in which the statement is
executed,records are fetched and send back to user.Once
records are sent the memory is deallocated.This memory area
is know as implicit cursors and the selected records are
known as "Active set".Implicit cursors are handled by
Oracle and user does not have control on it.But in case user
(programmer) needs to have control then one can declare
explicit cursors.In Explicit cursors, cursor is
declared,when it is opened, the stament is executed, and
the data is fetched in memory.The records will remain in
memory, till programmer does not close the cursor.The
advantage of this is ,one can select 'n' no of records and
fetch one by one.Also one can pass parameters to cursors
for getting new set of records.
Procedure is nothing but named PL/SQL block which can be
individually executed or can be called from other procedure
or function.It is stored as an object in database schema.
One can acheive polymorphism in procedures if they are a
part of package.
Cheers
vd

Is This Answer Correct ?    24 Yes 9 No

difference between cursor and procedure in a package..

Answer / a.jyothsna

Cursors in package should have a return type
Whereas for the procedures it's not required

Is This Answer Correct ?    13 Yes 12 No

Post New Answer

More SQL PLSQL Interview Questions

what is the difference between inner and outer join? Explain with example. : Sql dba

0 Answers  


Describe types of sql statements?

0 Answers  


What is a stored procedure ?

5 Answers  


Can a view be updated/inserted/deleted?If Yes under what conditions?

3 Answers  


How can we schedule the procedure to run automatically ?

3 Answers  






Define the select into statement.

0 Answers  


I Have A Table Like This. Cityno Cityname Mails 1 Bangalore 8km 2 Hsr Layout 20km 3 Mejistic 30km 4 Jayadeva 55km 5 Itpl 80km 6 Hebbal 115km I Have Data Like This I Want O/p Like This Distance No.ofcity 0-50km 3 51-100km 2 101-150km 4 And So On

6 Answers   DELL, HCL, Oracle,


Is sql a backend language?

0 Answers  


will function return more than one value how

9 Answers   Accenture,


what is myisam? : Sql dba

0 Answers  


What is an index in sql with example?

0 Answers  


How to load data with sql*loader?

0 Answers  


Categories