48 | Explicit Cursors in ORACLE PL/SQL | Oracle PL/SQL Programming

preview_player
Показать описание
Explicit Cursor
An explicit cursor is a named pointer to a private SQL area that stores information for processing a specific query or DML statement—typically, one that returns or affects multiple rows. You can use an explicit cursor to retrieve the rows of a result set one at a time.

Before using an explicit cursor, you must declare and define it. You can either declare it first (with cursor_declaration) and then define it later in the same block, subprogram, or package (with cursor_definition) or declare and define it at the same time (with cursor_definition).

An explicit cursor declaration and definition are also called a cursor specification and cursor body, respectively.
Semantics

cursor_declaration

cursor_name

The name of the explicit cursor that you are declaring now and will define later in the same block, subprogram, or package. This name can be any identifier except the reserved word SQL. Oracle recommends against giving a cursor the same name as a database table.

Explicit cursor names follow the same scoping rules as variables.
rowtype

The data type of the row that the cursor returns.

cursor_definition

Either defines an explicit cursor that was declared earlier or both declares and defines an explicit cursor.

cursor_name

Either the name of the explicit cursor that you previously declared and are now defining or the name of the explicit cursor that you are both declaring and defining. This name can be any identifier except the reserved word SQL. Oracle recommends against giving a cursor the same name as a database table.

rowtype

The data type of the row that the cursor returns. The columns of this row must match the columns of the row that select_statement returns.

select_statement

A SQL SELECT statement (not a PL/SQL SELECT INTO statement). If the cursor has formal parameters, each parameter must appear in select_statement. The select_statement can also reference other PL/SQL variables in its scope.

48 | Explicit Cursors in ORACLE PL/SQL | Oracle PL/SQL Programming

#explicit_cursor #oracleplsql #plsql #implicit_cursor
Рекомендации по теме
Комментарии
Автор

Hey there, kudos your efforts..Please i have a simple enquiry as a newbie..What is the main difference between cursor and view in sql? Thanks a lot.

hasanmougharbel
Автор

Sir Can you upload videos on Triggers also ?

shubhamvishwakarma