select rownum,co180c.custnm, sc010d.mdl, mc010m.lay, mc010m.spec, mc010m.thick, sc010d.ioqty, sc010d.iodt,
CASE WHEN sc010d.ioqty >= mc010m.ctqty * ROWNUM
THEN mc010m.ctqty
ELSE sc010d.ioqty - mc010m.ctqty * (ROWNUM-1) END as ioqty
from sc010d, mc010m, co180c,
(SELECT rownum FROM mc010m, sc010d where sc010d.iocls = 'O' and sc010d.iono = :as_iono and rownum <= ceil(sc010d.ioqty/mc010m.ctqty)) test1
where sc010d.cust = co180c.cust
and sc010d.mdl = mc010m.mdl
and sc010d.iocls = 'O'
and sc010d.iono = :as_iono
order by rownum
이런 SQL문에서 유저가 원하는 만큼 앞쪽에 빈 ROW를 삽입할 수 있는 방법이 있을까요... 도움 부탁드립니다 ㅎ
올려주신 SELECT 결과 앞에 원하는 수 만큼의 빈줄 삽입하는 것? 이라면
진하게 쓴 부분만 추가하시면 됩니다.
여기서 10이라고 있는 숫자 부분을 변수로 받으면 됩니다.
SELECT '', '', '', '', '', '', '', '', '' FROM DUAL CONNECT BY LEVEL <= 10
UNION ALL
SELECT '', '', '', '', '', '', '', '', '' FROM DUAL
select
rownum, co180c.custnm, sc010d.mdl, mc010m.lay, mc010m.spec, mc010m.thick, sc010d.ioqty, sc010d.iodt,
CASE
WHEN
sc010d.ioqty >= mc010m.ctqty * ROWNUM
THEN
mc010m.ctqty
ELSE
sc010d.ioqty - mc010m.ctqty * (ROWNUM-1)
END as ioqty
from
sc010d, mc010m, co180c,
(SELECT rownum FROM mc010m, sc010d where sc010d.iocls = 'O' and sc010d.iono = :as_iono and rownum <= ceil(sc010d.ioqty/mc010m.ctqty)) test1
where
sc010d.cust = co180c.cust
and sc010d.mdl = mc010m.mdl
and sc010d.iocls = 'O'
and sc010d.iono = :as_iono
order by
rownum