filmov
tv
PL/SQL Implicit Cursors, Explicit Cursor | Cursor in PL/SQL | PL-SQL Full Course Tutorial 2023 | PT

Показать описание
"PL/SQL Implicit Cursors, Explicit Cursor | Cursor in PL/SQL | PL-SQL Full
Course Tutorial 2023
#plsqlImplicitCursors #plsqlExplicitCursor #plsqlcursor #plsql #plsqlbasics
#plsqlprocedures #plsqlcursor #plsqlfunctions #plsqltriggers #plsqlvssql #oracleplsql
#PLSQLtutorialforbeginners #PLSQLtutorialinenglish #plsqlinterview #plsqlinenglish
previous video link - Loops In PL/SQL | Basic Loop, While Loop, For Loop in Pl/SQL | PL/SQL Course for Free
02:13 - implict cursor
13:21 - explicit cursor
14:09 - steps involved in explicit cursor
14:48 - declaring the cursor
15:45 -syntax to open the cursor
16:15 - fetching the cursor
18:36 - declare the cursor in the declare
18:40 - declare cursor
19:55 - open a cursor
20:45 - syntax for the fetch statement
Oracle creates a memory area, known as the context area, for processing an SQL statement, which contains all the information needed for processing the statement; for example, the number of rows processed, etc.
In PL/SQL, you can refer to the most recent implicit cursor as the SQL cursor, which always has attributes such as %FOUND, %ISOPEN, %NOTFOUND, and %ROWCOUNT.
%FOUND
Returns TRUE if an INSERT, UPDATE, or DELETE statement affected one or more rows or a SELECT INTO statement returned one or more rows. Otherwise, it returns FALSE.
%NOTFOUND
The logical opposite of %FOUND. It returns TRUE if an INSERT, UPDATE, or DELETE statement affected no rows, or a SELECT INTO statement returned no rows. Otherwise, it returns FALSE.
%ISOPEN
Always returns FALSE for implicit cursors, because Oracle closes the SQL cursor automatically after executing its associated SQL statement.
%ROWCOUNT
Returns the number of rows affected by an INSERT, UPDATE, or DELETE statement, or returned by a SELECT INTO statement.
Explicit Cursors
Explicit cursors are programmer-defined cursors for gaining more control over the context area. An explicit cursor should be defined in the declaration section of the PL/SQL Block.
Working with an explicit cursor includes the following steps −
Declaring the cursor for initializing the memory
Opening the cursor for allocating the memory
Fetching the cursor for retrieving the data
Closing the cursor to release the allocated memory
The syntax for creating an explicit cursor is −
CURSOR cursor_name IS select_statement;
Declaring the Cursor
Declaring the cursor defines the cursor with a name and the associated SELECT statement. For example −
CURSOR c_customers IS SELECT id, name, address FROM customers;
Opening the Cursor
Opening the cursor allocates the memory for the cursor and makes it ready for fetching the rows returned by the SQL statement into it. For example, we will open the above defined cursor as follows
OPEN c_customers;
Fetching the Cursor
Fetching the cursor involves accessing one row at a time. For example, we will fetch rows from the above-opened cursor as follows
FETCH c_customers INTO c_id, c_name, c_addr;
Closing the Cursor
Closing the cursor means releasing the allocated memory. For example, we will close the above-opened cursor as follows
CLOSE c_customers;
Social media Links:
To get the regular updates:
Playlists:
Virtual Coffee with Jagadeesh:
Digital Logic Design:
Computer Organization and Architecture:
C Programming:
Data Structures:
Theory of Computation:
Compiler Design:
Computer Networks:
For GATE PYQs and much more explore:
Course Tutorial 2023
#plsqlImplicitCursors #plsqlExplicitCursor #plsqlcursor #plsql #plsqlbasics
#plsqlprocedures #plsqlcursor #plsqlfunctions #plsqltriggers #plsqlvssql #oracleplsql
#PLSQLtutorialforbeginners #PLSQLtutorialinenglish #plsqlinterview #plsqlinenglish
previous video link - Loops In PL/SQL | Basic Loop, While Loop, For Loop in Pl/SQL | PL/SQL Course for Free
02:13 - implict cursor
13:21 - explicit cursor
14:09 - steps involved in explicit cursor
14:48 - declaring the cursor
15:45 -syntax to open the cursor
16:15 - fetching the cursor
18:36 - declare the cursor in the declare
18:40 - declare cursor
19:55 - open a cursor
20:45 - syntax for the fetch statement
Oracle creates a memory area, known as the context area, for processing an SQL statement, which contains all the information needed for processing the statement; for example, the number of rows processed, etc.
In PL/SQL, you can refer to the most recent implicit cursor as the SQL cursor, which always has attributes such as %FOUND, %ISOPEN, %NOTFOUND, and %ROWCOUNT.
%FOUND
Returns TRUE if an INSERT, UPDATE, or DELETE statement affected one or more rows or a SELECT INTO statement returned one or more rows. Otherwise, it returns FALSE.
%NOTFOUND
The logical opposite of %FOUND. It returns TRUE if an INSERT, UPDATE, or DELETE statement affected no rows, or a SELECT INTO statement returned no rows. Otherwise, it returns FALSE.
%ISOPEN
Always returns FALSE for implicit cursors, because Oracle closes the SQL cursor automatically after executing its associated SQL statement.
%ROWCOUNT
Returns the number of rows affected by an INSERT, UPDATE, or DELETE statement, or returned by a SELECT INTO statement.
Explicit Cursors
Explicit cursors are programmer-defined cursors for gaining more control over the context area. An explicit cursor should be defined in the declaration section of the PL/SQL Block.
Working with an explicit cursor includes the following steps −
Declaring the cursor for initializing the memory
Opening the cursor for allocating the memory
Fetching the cursor for retrieving the data
Closing the cursor to release the allocated memory
The syntax for creating an explicit cursor is −
CURSOR cursor_name IS select_statement;
Declaring the Cursor
Declaring the cursor defines the cursor with a name and the associated SELECT statement. For example −
CURSOR c_customers IS SELECT id, name, address FROM customers;
Opening the Cursor
Opening the cursor allocates the memory for the cursor and makes it ready for fetching the rows returned by the SQL statement into it. For example, we will open the above defined cursor as follows
OPEN c_customers;
Fetching the Cursor
Fetching the cursor involves accessing one row at a time. For example, we will fetch rows from the above-opened cursor as follows
FETCH c_customers INTO c_id, c_name, c_addr;
Closing the Cursor
Closing the cursor means releasing the allocated memory. For example, we will close the above-opened cursor as follows
CLOSE c_customers;
Social media Links:
To get the regular updates:
Playlists:
Virtual Coffee with Jagadeesh:
Digital Logic Design:
Computer Organization and Architecture:
C Programming:
Data Structures:
Theory of Computation:
Compiler Design:
Computer Networks:
For GATE PYQs and much more explore:
Комментарии