You can only ask for "*" if you are referring to a table/view/subquery/nested table. Instead of returning a row containing an object, return a one-row table of that object.
create or replace type t_d_e force as object(
deptno number(2,0),
dname varchar2(14),
ename varchar2(10),
job varchar2(10)
)
/
create or replace type tt_d_e force as table of t_d_e
/
with de10 as (
select tt_d_e(t_d_e(deptno, dname, ename, job)) d_e10
from dept join emp using(deptno)
where deptno = 10 and rownum = 1
)
, de20 as (
select tt_d_e(t_d_e(deptno, dname, ename, job)) d_e20
from dept join emp using(deptno)
where deptno = 20 and rownum = 1
)
, de30 as (
select tt_d_e(t_d_e(deptno, dname, ename, job)) d_e30
from dept join emp using(deptno)
where deptno = 30 and rownum = 1
)
select data10.*, data20.*, data30.*
from de10, table(d_e10) data10,
de20, table(d_e20) data20,
de30, table(d_e30) data30
/
DEPTNO DNAME ENAME JOB DEPTNO DNAME ENAME JOB DEPTNO DNAME ENAME JOB
---------- -------------- ---------- ---------- ---------- -------------- ---------- ---------- ---------- -------------- ---------- ----------
10 ACCOUNTING KING PRESIDENT 20 RESEARCH JONES MANAGER 30 SALES BLAKE MANAGER
Or maybe this is closer to what you want?
with de10 as (
select deptno, dname, ename, job
from dept join emp using(deptno)
where deptno = 10 and rownum = 1
)
, de20 as (
select deptno, dname, ename, job
from dept join emp using(deptno)
where deptno = 20 and rownum = 1
)
, de30 as (
select deptno, dname, ename, job
from dept join emp using(deptno)
where deptno = 30 and rownum = 1
)
select * from (
select * from de10 union all
select * from de20 union all
select * from de30
)
pivot(
max(dname) dname, max(ename) ename, max(job) job
for deptno in(10 d10,20 d20,30 d30)
)
D10_DNAME D10_ENAME D10_JOB D20_DNAME D20_ENAME D20_JOB D30_DNAME D30_ENAME D30_JOB
-------------- ---------- --------- -------------- ---------- --------- -------------- ---------- ---------
ACCOUNTING KING PRESIDENT RESEARCH JONES MANAGER SALES BLAKE MANAGER