Monday, November 5, 2018

Cursors in Oracle

There are two types of cursors present in PL/SQL:-

Implicit Cursors:-

  • Automatically created whenever a SQL statement (DML) is executed.
  • For SELECT statement this implicit cursor consists of rows that will be retrieved.
  • For INSERT -->it will be the rows that are going to be inserted
  • For UPDATE--> it will be the rows that are going to be affected
  • For DELETE--> it will be the rows that will be deleted
  • You can find if any row is affected or not and how many rows are affected by using SQL%ATTRIBUTES.

Explicit Cursors:-

  • Explicit cursors are explicitly declared in the PL/SQL declare section
  • You can access this cursor in the PL/SQL code using cursor name
  • Explicit cursors can be defined only for the select statements
  • You can find if any row is affected or not and how many rows are affected by using <cursor_name>%ATTRIBUTES


No comments:

Post a Comment

Query to get Parent and Child Accounts in Oracle APPS R12

SELECT ffv1.flex_value parent_account       ,ffvt1.description parent_account_desc   ,ffv2.flex_value child_account   ,ffvt2.description...