Collections:
Retrieve Data from a Cursor to a RECORD in Oracle
How To Retrieve Data from a Cursor to a RECORD in Oracle?
✍: FYIcenter.com
If you have a cursor opened ready to use, you can also use the FETCH statement to retrieve data from the cursor into a RECORD variable as shown in the tutorial exercise below:
CREATE OR REPLACE PROCEDURE FYI_CENTER AS
CURSOR t_list IS SELECT first_name, last_name
FROM employees;
TYPE name_rec IS RECORD (
f_name VARCHAR2(10),
l_name VARCHAR2(10)
);
n name_rec;
BEGIN
OPEN t_list;
FETCH t_list INTO n;
DBMS_OUTPUT.PUT_LINE('Name = ' || n.f_name || ' '
|| n.l_name);
FETCH t_list INTO n;
DBMS_OUTPUT.PUT_LINE('Name = ' || n.f_name || ' '
|| n.l_name);
CLOSE t_list;
END;
/
Name = Ellen Abel
Name = Sundar Ande
⇒ Use FETCH Statement in a Loop in Oracle
⇐ Retrieve Data from an Explicit Cursor in Oracle
2018-07-22, 3364🔥, 0💬
Popular Posts:
What Are the Underflow and Overflow Behaviors on FLOAT Literals in SQL Server Transact-SQL? If you e...
How To Escape Special Characters in SQL statements in MySQL? There are a number of special character...
How to download and install Microsoft .NET Framework Version 2.0 in SQL Server? .NET Framework Versi...
Can You Drop an Index Associated with a Unique or Primary Key Constraint in Oracle? You can not dele...
What Is Oracle in Oracle? Oracle is a company. Oracle is also a database server, which manages data ...