What is difference between a Cursor declared in a procedure
and Cursor declared in a package specification ?

Answers were Sorted based on User's Feedback



What is difference between a Cursor declared in a procedure and Cursor declared in a package specif..

Answer / tulsi

A cursor declared in a package specification is global and
can be accessed by other procedures or procedures in a
package.
A cursor declared in a procedure is local to the procedure
that can not be accessed by other procedures.

Is This Answer Correct ?    40 Yes 2 No

What is difference between a Cursor declared in a procedure and Cursor declared in a package specif..

Answer / ratan singh sengar

SP is a set of SQL Statements that resides in server. Advantage of SP is just that it is pre compiled and available in the server. So, whenever this SP is called, its executed instantly since its already been compiled. This makes the faster performance while executing the SP.
cursor:
Cursors are add on feature of SP , for row by row validations.
For instance : You have a list of employees belong to various department. For calculating the bonus % which varies for department to department, you use cursors to calculate Bonus.

Is This Answer Correct ?    0 Yes 4 No

Post New Answer

More SQL PLSQL Interview Questions

Hi, Can anybody please explain me the flow of the below query. I am not able to understand how this query works. This query is for finding the Nth highest salary.. SELECT DISTINCT (a.sal) FROM EMP A WHERE &N = (SELECT COUNT (DISTINCT (b.sal)) FROM EMP B WHERE a.sal<=b.sal); If N = 2 then second highest salary will be the o/p. If N = 3 then third highest salary will be the o/p. and so on.. Thanks, Nitin

5 Answers   Deloitte, Ness Technologies,


What will you get by the cursor attribute sql%notfound?

0 Answers  


What is the benefit of foreign key?

0 Answers  


What is clustered index in sql?

0 Answers  


What are the query optimization techniques?

0 Answers  






What is sql partition function?

0 Answers  


How do I run a sql trace?

0 Answers  


What are the differences between Database Trigger and Integrity constraints ?

4 Answers  


Is vs as in pl sql?

0 Answers  


How to select unique records from a table?

0 Answers  


what is purge command explain about oracle performance tuning

2 Answers   Accenture, eCentric Solutions,


how to select alphabets in a one column , for this the table name is PA_TASKS and column name is TASK_NUMBER, In TASK_NUMBER the data like this 1.1.3NN,1.1.4NN,1.5.1NN,1.3.2NE,1.5NN,1NN,1.2NE,1CE , For this i need to disply output as NN,NN,NN,NE,NN,NN,NE,CE, Its some urgent requirement ,thanks in advance

6 Answers  


Categories