PL/SQL (MOSC)

MOSC Banner

can we select two tables data into one variable

edited Dec 28, 2012 4:11AM in PL/SQL (MOSC) 5 commentsAnswered ✓
 Hi,
i am trying to fetch the whole emp,dept data into one record variable

declare
type rec is record(v_rec emp%rowtype,v_dec dept%rowtype);
type d is record ( v rec);
f d;
--r rec;
begin
select e.* into f.v.v_rec from emp e,dept d where e.deptno=d.deptno and e.empno=7788;
select d.* into f.v.v_dec from emp e,dept d where e.deptno=d.deptno and e.empno=7788;
dbms_output.put_line(f.v.v_dec.dname||'   '||f.v.v_dec.loc||'  '||f.v.v_dec.deptno);

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center