SELECT /*+ GATHER_PLAN_STATISTICS */
ename, sal, job, substr(통합, 1, INSTR(통합, 'A')-1) as 토탈,
substr(통합, INSTR(통합, 'A')+1, INSTR(통합, 'B')-INSTR(통합, 'A')-1) AS 최대
, substr(통합, INSTR(통합, 'B')+1,30) AS 최소
FROM
(SELECT ENAME, SAL, JOB,
( select sum(sal) ||'A'|| max(sal)||'B' || min(sal)
from emp
where job='SALESMAN') AS 통합
FROM emp
where job='SALESMAN');
SELECT * FROM TABLE(dbms_xplan.display_cursor(null, null, 'ALLSTATS LAST'));
SELECT /*+ GATHER_PLAN_STATISTICS */
ename, sal, job,
substr(통합, 1,
substr(통합, length(통합)-2,1)) as 토탈,
substr(통합, substr(통합, length(통합)-2,1)+1,
substr(통합, length(통합)-1,1)) AS 최대,
substr(통합, substr(통합, length(통합)-2,1)+substr(통합, length(통합)-1,1)+1,
substr(통합, length(통합),1)) AS 최소
FROM
(SELECT ENAME, SAL, JOB,
( select sum(sal) || max(sal)|| min(sal)||LENGTH(SUM(SAL))||LENGTH(MAX(SAL))||LENGTH(MIN(SAL))
from emp
where job='SALESMAN') AS 통합
FROM emp
where job='SALESMAN');
SELECT /*+ GATHER_PLAN_STATISTICS */
ename, sal, job, REPLACE(SUBSTR(통합,1,10),' ',NULL) as 토탈,
REPLACE(SUBSTR(통합,11,10),' ',NULL) AS 최대,
REPLACE(SUBSTR(통합,21,10),' ',NULL) AS 최소
FROM
(SELECT ENAME, SAL, JOB,
( select RPAD(sum(sal),10,' ') || RPAD(max(sal),10,' ')|| RPAD(min(sal), 10, ' ')
from emp
where job='SALESMAN') AS 통합
FROM emp
where job='SALESMAN');