TYPE 오브젝트
-- FN_REPORT_01
DROP TYPE T_REPORT01_TAB;
CREATE OR REPLACE TYPE T_REPORT01_OBJ AS OBJECT
(
COL01 VARCHAR2(500 CHAR),
COL02 VARCHAR2(50 CHAR),
COL04 VARCHAR2(50 CHAR),
COL05 VARCHAR2(50 CHAR),
COL06 VARCHAR2(50 CHAR),
COL07 VARCHAR2(50 CHAR),
COL08 VARCHAR2(50 CHAR)
);
CREATE OR REPLACE TYPE T_REPORT01_TAB AS TABLE OF T_REPORT01_OBJ;
--SELECT * FROM TABLE(FN_REPORT_01('1-3I9PQT')) T1;
CREATE OR REPLACE FUNCTION 계정.FN_REPORT_01
(
P_NAME IN VARCHAR2
) RETURN T_REPORT01_TAB PIPELINED
IS
BEGIN
FOR ROWS_CON IN (
SELECT A.COL01 AS COL01 --"모델명"
, A.COL02 AS COL02--"환율"
, TO_CHAR(A.COL03,'999,999,999,999,999') AS COL04 --"계약가(KRW)"
, A.COL05 AS COL05 --"통화"
, TO_CHAR(A.COL03_CURR,'999,999,999,999,999') AS COL06 --"계약가(통화)"
, TO_CHAR(A.COL07 ,'999,999,999,999,999') ||'<br>('||
DECODE(A.COL03,0,0,ROUND(( 100 * A.COL07 )/A.COL03,0))||'%)' AS COL07 --"총원가"
, TO_CHAR(A.COL08,'999,999,999,999,999') ||'<br>('||
DECODE(A.COL03,0,0,ROUND(( 100 * A.COL08 )/A.COL03,0))||'%)' AS COL08 --"세전이익"
FROM (..