Quick Search:
 
 The Oracle PL/SQL OPEN Keyword      [Return To Index] Jump to:  

Term: OPEN

Definition:
In Oracle PL/SLQ, OPEN is the first stage of a Cursor Execution Cycle, where Oracle executes the SQL query associated with the cursor and returns the result set into the context area. This is an overview of the steps which take place in the OPEN stage:

  1. A portion of memory is dynamically allocated for context area
  2. The SELECT query is parsed, bound, and executed to fetch the result set
  3. The cursor now points the first row in the active set

Example Syntax:

OPEN [CURSOR NAME];
FETCH [CURSOR NAME] INTO [LIST OF MEMORY VARIABLES];
CLOSE [CURSOR NAME]


Example Usage:

DECLARE
CURSOR C IS
SELECT ENAME, DEPTNO
FROM EMPLOYEE
WHERE EMPNO=100;
L_ENAME VARCHAR2(100);
L_DEPTNO NUMBER;
BEGIN
OPEN C;
FETCH C INTO L_ENAME, L_DEPTNO;
CLOSE C;
END;



Related Links:
 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org