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
2018-07-22, 890👍, 0💬
Popular Posts:
Where to find answers to frequently asked questions on CREATE, ALTER and DROP Statements in MySQL? H...
What Are Date and Time Functions in MySQL? MySQL offers a number of functions for date and time valu...
How REAL and FLOAT Literal Values Are Rounded in SQL Server Transact-SQL? By definition, FLOAT(n) sh...
How To Change the Name of a Database User in SQL Server? If you want to change the name of an existi...
What are single-byte character string data types supported in SQL Server Transact-SQL? Single-byte c...