Вы можете сгенерировать такую логику, как при использовании этого SQL
select vl as date1, myCol as myCol1
from
(
select to_char(myDate,'yyyy-mm-dd') as mD,
to_char(myDate,'DY') as Dy,
to_char(myVal) as mVl, t.* from tab t
where to_char(mydate,'yyyy-mm-dd') = <a_date_parameter>
)
unpivot (vl for myCol in (mD,Dy,myHourStart, myHourEnd,mVl,status))
вкладом unpivot
концепции как:
create table tab( myDate date, myHourStart varchar2(5), myHourEnd varchar2(5), myVal int, status varchar2(15) );
insert all
into tab values( date'2018-07-03','20:00','12:15', 465, null )
into tab values( date'2018-07-02','20:00','20:05', -5, 'FAIL' )
into tab values( date'2018-06-29','19:30','19:04', 26, null )
into tab values( date'2018-06-28','20:00','19:07', 53, null )
into tab values( date'2018-06-27','20:00','19:37', 23, null )
select * from dual;
select date1, date2, date3, date4, date5 from
( select vl as date1, myCol as myCol1
from
(
select to_char(myDate,'yyyy-mm-dd') as mD,
to_char(myDate,'DY') as Dy,
to_char(myVal) as mVl, t.* from tab t
where to_char(mydate,'yyyy-mm-dd') = '2018-06-27'
)
unpivot (vl for myCol in (mD,Dy,myHourStart, myHourEnd,mVl,status))
) q1 join
( select vl as date2, myCol as myCol2
from
(
select to_char(myDate,'yyyy-mm-dd') as mD,
to_char(myDate,'DY') as Dy,
to_char(myVal) as mVl, t.* from tab t
where to_char(mydate,'yyyy-mm-dd') = '2018-06-28'
)
unpivot (vl for myCol in (mD,Dy,myHourStart, myHourEnd,mVl,status))
) q2 on ( q1.myCol1 = q2.myCol2 )
join
( select vl as date3, myCol as myCol3
from
(
select to_char(myDate,'yyyy-mm-dd') as mD,
to_char(myDate,'DY') as Dy,
to_char(myVal) as mVl, t.* from tab t
where to_char(mydate,'yyyy-mm-dd') = '2018-06-29'
)
unpivot (vl for myCol in (mD,Dy,myHourStart, myHourEnd,mVl,status))
) q3 on ( q1.myCol1 = q3.myCol3 )
join
( select vl as date4, myCol as myCol4
from
(
select to_char(myDate,'yyyy-mm-dd') as mD,
to_char(myDate,'DY') as Dy,
to_char(myVal) as mVl, t.* from tab t
where to_char(mydate,'yyyy-mm-dd') = '2018-07-02'
)
unpivot (vl for myCol in (mD,Dy,myHourStart, myHourEnd,mVl,status))
) q4 on ( q1.myCol1 = q4.myCol4 )
join
( select vl as date5, myCol as myCol5
from
(
select to_char(myDate,'yyyy-mm-dd') as mD,
to_char(myDate,'DY') as Dy,
to_char(myVal) as mVl, t.* from tab t
where to_char(mydate,'yyyy-mm-dd') = '2018-07-03'
)
unpivot (vl for myCol in (mD,Dy,myHourStart, myHourEnd,mVl,status))
) q5 on ( q1.myCol1 = q5.myCol5 );
Демонстрация SQL Fiddle