REPLACE PROCEDURE SP_TEMP ()
CALL DBC.SYSEXECSL(
'REPLACE VIEW TEMP_V
AS
SELECT ID,ARTICLE,
CASE YEAR_MONTH
WHEN CAST(CAST(CAST(DATE AS FORMAT 'YYYYMM')AS CHAR(6))AS INT)
THEN AMOUNT
ELSE 0
END AS "REVENUE-'||CAST(CAST(DATE AS FORMAT 'YYYYMM')AS CHAR(6))||'",
CASE YEAR_MONTH
WHEN CAST(CAST(CAST(ADD_MONTHS(DATE,-1) AS FORMAT 'YYYYMM')AS CHAR(6))AS INT)
THEN AMOUNT
ELSE 0
END AS "REVENUE-'||CAST(CAST(ADD_MONTHS(DATE,-1) AS FORMAT 'YYYYMM')AS CHAR(6))||'"
FROM SALES_HIST');
CALL SP_TEMP ();
SELECT * FROM TEMP_V;
REPLACE PROCEDURE SP_TEMP ()
CALL DBC.SYSEXECSL(
'REPLACE VIEW TEMP_V
AS
SELECT ID,ARTICLE,
CASE YEAR_MONTH
WHEN CAST(CAST(CAST(DATE AS FORMAT 'YYYYMM')AS CHAR(6))AS INT)
THEN AMOUNT
ELSE 0
END AS "REVENUE-'||CAST(CAST(DATE AS FORMAT 'YYYYMM')AS CHAR(6))||'",
CASE YEAR_MONTH
WHEN CAST(CAST(CAST(ADD_MONTHS(DATE,-1) AS FORMAT 'YYYYMM')AS CHAR(6))AS INT)
THEN AMOUNT
ELSE 0
END AS "REVENUE-'||CAST(CAST(ADD_MONTHS(DATE,-1) AS FORMAT 'YYYYMM')AS CHAR(6))||'"
FROM SALES_HIST');
CALL SP_TEMP ();
SELECT * FROM TEMP_V;