difference between cursor and procedure in a package
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
Explain the usage of WHERE CURRENT OF clause in cursors ?
How many functions are there in sql?
What is sql scripting?
What is the main difference between a UNION statement and a UNION ALL statement? 1. A UNION statement eliminates duplicate rows; a UNION ALL statement includes duplicate rows. 2. A UNION statement can be used to combine any number of queries; a UNION ALL statement can be used to combine a maximum of two queries. 3. A UNION statement can only combine queries that have parallel fields in the SELECT list; a UNION ALL statement can combine queries with differing SELECT list structures. 4. A UNION statement cannot be used with aggregate functions; a UNION ALL statement can be used with aggregate functions. 5. There is no difference between the two statements; they are interchangeable.
What is the main reason behind using an index?
What is sqlexception in java?
How do I save the results of sql query in a file?
What is a database? Explain
Why select is used in sql?
What problem one might face while writing log information to a data-base table in pl/sql?
What are tables in sql?
how to retrieve last tree records from table? select *from emp where rownum > (select count(*)-3 from emp); i am using this query to get last three records from table but its not giving any output, so please tell me what is the error in this query.