How To Define an Oracle Cursor Variable?
Submitted by: AdministratorTo define cursor variable, you must decide which REF CURSOR data type to use. There are 3 ways to select a REF CURSOR data type:
► Define your own specific REF CURSOR types using the TYPE ... RETURN statement.
► Define your own generic REF CURSOR type using the TYPE ... statement.
► Use the system defined REF CURSOR type: SYS_REFCURSOR.
The follwoing tutorial exercise defines 3 cursor variables in 3 different ways:
CREATE OR REPLACE PROCEDURE ggl_CENTER AS
TYPE emp_ref IS REF CURSOR RETURN employees%ROWTYPE;
TYPE any_ref IS REF CURSOR;
emp_cur emp_ref;
any_cur any_ref;
sys_cur SYS_REFCURSOR;
BEGIN
NULL;
END;
/
Submitted by: Administrator
► Define your own specific REF CURSOR types using the TYPE ... RETURN statement.
► Define your own generic REF CURSOR type using the TYPE ... statement.
► Use the system defined REF CURSOR type: SYS_REFCURSOR.
The follwoing tutorial exercise defines 3 cursor variables in 3 different ways:
CREATE OR REPLACE PROCEDURE ggl_CENTER AS
TYPE emp_ref IS REF CURSOR RETURN employees%ROWTYPE;
TYPE any_ref IS REF CURSOR;
emp_cur emp_ref;
any_cur any_ref;
sys_cur SYS_REFCURSOR;
BEGIN
NULL;
END;
/
Submitted by: Administrator
Read Online Oracle Database Job Interview Questions And Answers
Top Oracle Database Questions
☺ | How To Write Date and Time Interval Literals in Oracle? |
☺ | How Run SQL*Plus Commands That Are Stored in a Local File? |
☺ | What Happens to Indexes If You Drop a Table? |
☺ | How To Run SQL*Plus Commands in SQL Developer? |
☺ | How To Use Values from Other Tables in UPDATE Statements using Oracle? |
Top DB Oracle Categories
☺ | Oracle PL-SQL Interview Questions. |
☺ | Oracle DBA Interview Questions. |
☺ | Oracle D2K Interview Questions. |
☺ | OCI Interview Questions. |
☺ | Oracle RMAN Interview Questions. |