How do I recover an entire record and save in a variable?
Save record in a variable
- dr_gori
- Moderador
- Posts: 5024
- Joined: Mon, 03 May 2004 3:08 pm
- Location: Portland, OR USA
- Contact:
Thomas F. G
Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered
Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered
This code is a very good practice.
DECLARE
--declara o cursor desejado
CURSOR cur_emp ( p_empno EMP.EMPNO%TYPE )
IS
SELECT * FROM EMP WHERE EMPNO=p_empno;
--declara o array que conterá a linha toda
rec_emp cur_emp%ROWTYPE;
BEGIN
--Pega a linha desejada e grava no array
OPEN cur_emp ( 7788 );
FETCH cur_emp INTO rec_emp;
CLOSE cur_emp;
DBMS_OUTPUT.PUT_LINE( rec_emp.ENAME );
END;
SQL> set serveroutput on
SQL> @t
SCOTT
PL/SQL procedure successfully completed.
SQL>
-
- Information
-
Who is online
Users browsing this forum: No registered users and 1 guest