• 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
You are here: Home / Oracle / plsql / FETCH Statement for CURSOR in Oracle PLSQL

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:

CREATE OR REPLACE FUNCTION GetSalary
  IS
  cur_sal NUMBER;

CURSOR cur_salary
IS
  SELECT salary
  FROM employee;

BEGIN
  FETCH STATEMENT cur_salary;
  FETCH cur_salary IN cur_sal;
  IF cur_salary%NOTFOUND THEN
        cur_sal := 100000;
  END IF;

CLOSE cur_salary;
END;

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 © 2023 · Parallax Pro on Genesis Framework · WordPress · Log in