Hi,
I am new to the concept of PL/SQL Collection.
Please give me an idea/Link from which i can easily understand the difference between PL/SQL table and Record Type.
Thanks in Advance.
Dilip
declare
type rec is record
(v_ename emp.ename%type,
v_empno emp.empno%type,
v_job emp.job%type,
v_sal emp.sal%type,
v_deptno emp.deptno%type,
v_mgr emp.mgr%type );
rec1 rec;
begin
select ename,empno,job,sal,deptno,mgr into rec1 from emp
where empno=(select empno from emp where ename='&ename');
dbms_output.put_line('employee name is:->'|| rec1.v_ename ||
'no is :- '||rec1.v_empno || ' ' || ' having designatio:-' ||
rec1.v_job || 'with salary' || rec1.V_sal || 'and department
no is:- ' || rec1.V_deptno);
if rec1.V_ename='KING' then
dbms_output.put_line('for presedent manager ' || rec1.V_mgr ||
' is null');
end if;
end;
//
DECLARE
TYPE BIN_TAB IS TABLE OF EMP%ROWTYPE
INDEX BY BINARY_INTEGER;
BIN_TAB1 BIN_TAB;
BEGIN
FOR I IN 1..1 LOOP
SELECT * INTO BIN_TAB1(I) FROM EMP WHERE EMPNO = &D;
END LOOP;
FOR I IN 1..1 LOOP
DBMS_OUTPUT.PUT_LINE(BIN_TAB1(I). DEPTNO ||BIN_TAB1(I).ENAME||BIN_TAB1(I).JOB
||BIN_TAB1(I).SAL ||BIN_TAB1(I).MGR);
DBMS_OUTPUT.PUT_LINE(BIN_TAB1(1).ENAME);
END LOOP;
END;
//