-- %TYPE is used to declare a field with the same type as
-- that of a specified table's column:
DECLARE
v_EmpName emp.ename%TYPE;
BEGIN
SELECT ename INTO v_EmpName FROM emp WHERE ROWNUM = 1;
DBMS_OUTPUT.PUT_LINE('Name = ' || v_EmpName);
END;
/
-- %ROWTYPE is used to declare a record with the same types as
-- found in the specified database table, view or cursor:
DECLARE
v_emp emp%ROWTYPE;
BEGIN
v_emp.empno := 10;
v_emp.ename := 'Rajani';
v_emp.dept := 'IT';
END;
/
-- that of a specified table's column:
DECLARE
v_EmpName emp.ename%TYPE;
BEGIN
SELECT ename INTO v_EmpName FROM emp WHERE ROWNUM = 1;
DBMS_OUTPUT.PUT_LINE('Name = ' || v_EmpName);
END;
/
-- %ROWTYPE is used to declare a record with the same types as
-- found in the specified database table, view or cursor:
DECLARE
v_emp emp%ROWTYPE;
BEGIN
v_emp.empno := 10;
v_emp.ename := 'Rajani';
v_emp.dept := 'IT';
END;
/
No comments:
Post a Comment