• Skip to primary navigation
  • Skip to main content

Tech Honey

The #1 Website for Oracle PL/SQL, OA Framework and HTML

  • Home
  • HTML
    • Tags in HTML
    • HTML Attributes
  • OA Framework
    • Item in OAF
    • Regions in OAF
    • General OAF Topics
  • Oracle
    • statement
    • function
    • clause
    • plsql
    • sql

syntax and example of FETCH STATEMENT CURSOR in oracle database query

FETCH Statement for CURSOR in Oracle PLSQL

December 1, 2012 by techhoneyadmin

FETCH statement in Oracle PLSQL is used to access the records from the CURSOR which has been previously opened.

Oracle PSQL Syntax to use FETCH CURSOR statement is:

FETCH cursor_name INTO ;

Let’s understand, how to use FETCH Statement in a cursor from the help of the below PLSQL function:

view source
print?
1CREATE OR REPLACE FUNCTION GetSalary
2  IS
3  cur_sal NUMBER;
4 
5CURSOR cur_salary
6IS
7  SELECT salary
8  FROM employee;
9 
10BEGIN
11  FETCH STATEMENT cur_salary;
12  FETCH cur_salary IN cur_sal;
13  IF cur_salary%NOTFOUND THEN
14        cur_sal := 100000;
15  END IF;
16 
17CLOSE cur_salary;
18END;

The line FETCH cur_salary IN cur_sal is used to FETCH the records in the cursor.

Filed Under: plsql Tagged With: CURSORPLSQL, FETCH STATEMENT CURSOR in oracle plsql, FETCH STATEMENT CURSOR in oracle sql, FetchCursorPLSQL, how to FETCH STATEMENT CURSOR in oracle database query, how to FETCH STATEMENT CURSOR in oracle plsql, how to FETCH STATEMENT CURSOR in oracle sql, syntax and example of FETCH STATEMENT CURSOR in oracle database query, syntax and example of FETCH STATEMENT CURSOR in oracle plsql, syntax and example of FETCH STATEMENT CURSOR in oracle sql, using FETCH STATEMENT CURSOR in oracle database query, using FETCH STATEMENT CURSOR in oracle plsql, using FETCH STATEMENT CURSOR in oracle sql

Copyright © 2025 · Parallax Pro on Genesis Framework · WordPress · Log in