What is a package cursor?

          

What is a package cursor?

<<Previous  Next>>

Oracle - What is a package cursor? - Feb 07, 2010 at 14:20 PM by Shuchi Gauri

What is a package cursor?

A Package that returns a Cursor type is a package cursor.

Eg:
Create or replace package pkg_Util is
        cursor c_emp is select * from employee;
        r_emp c_emp%ROWTYPE;
end;

/*Another package using this package*/
Create or replace package body pkg_aDifferentUtil is
procedure p_printEmps is
    begin
          open pkg_Util.c_emp;
          loop
                 fetch pkg_Util.c_emp into pkg_Util.r_emp;
                 exit when pkg_Util.c_emp%NOTFOUND;
                 DBMS_OUTPUT.put_line(pkg_Util.r_emp.first_Name);
          end loop;
          close pkg_Util.c_emp;
    end;
end;

Oracle - What is a package cursor? - April 10, 2009 at 11:00 AM

What is a package cursor?  

In a package cursor, the SQL statement for the cursor is attached dynamically at runtime from calling procedures.

Also read

Oracle cursors interview questions

What a SELECT FOR UPDATE cursor represent?, What WHERE CURRENT OF clause does in a cursor?, Can you pass a parameter to a cursor?, Explain the functioning of CURSOR FOR LOOP with example., Define Simple/Explicit , Parametric and Internal/Implicit cursor.............

What is the difference between REF Cursor & Normal Cursor in oracle?

Normal cursors fall under the category of static cursors while REF cursors are dynamic.........

What is use of a cursor variable in oracle?

A cursor variable works like pointer in C. It is used to hold address of an item rather than the item itself. Cursor variables can be used to hold different values at run time............

Oracle - use of "for update of"

The CURSOR FOR UPDATE obtains a lock on a selected number of rows that have not undergone a COMMIT yet.............. .

<<Previous  Next>>



Write your comment - Share Knowledge and Experience


 

 
Interview questions
Latest MCQs
» General awareness - Banking » ASP.NET » PL/SQL » Mechanical Engineering
» IAS Prelims GS » Java » Programming Language » Electrical Engineering
» English » C++ » Software Engineering » Electronic Engineering
» Quantitative Aptitude » Oracle » English » Finance
Home | About us | Sitemap | Contact us | We are hiring