빨간색으로 칠해놨는데 저게 무엇을 의미하는건가요 ...? AS (별칭)은 알지만 ;; WITH ? 어떤 의미이고 주로 어떨때 사용하는건가요...?
LOOP
IF X_CURR_DATE > L_E_DATE THEN
X_SQL_04 := X_SQL_04 || ', 0 ' || CHR(13) ;
ELSE
X_SQL_04 := X_SQL_04 || ', A.WORK_' || X_CURR_DATE || CHR(13) ;
END IF ;
X_CURR_DATE := TO_CHAR(TO_DATE(X_CURR_DATE, 'YYYYMMDD') + 1, 'YYYYMMDD') ;
X_LOOP_CNT := X_LOOP_CNT + 1 ;
EXIT WHEN X_LOOP_CNT > 31 ;
END LOOP ;
X_SQL := X_SQL || ' WITH A AS ( ' || CHR(13) ;
X_SQL := X_SQL || ' SELECT A.COMP_SEQ , A.EST_SEQ , A.CUST_SEQ ' || CHR(13) ;
X_SQL := X_SQL || ' , A.FULL_FOOD_NM, A.FOOD_DES, A.FOOD_REMARK, A.FOOD_UNIT_SEQ ' || CHR(13) ;
X_SQL := X_SQL || ' , A.ITEM_SEQ, A.UNIT_SEQ , A.TAX_KIND, A.VAT_RATE, A.PRICE_TYPE, A.EST_TYPE , A.EST_NO , A.FINE_YN, A.SORT_ORD, A.EST_COLOR ' || CHR(13) ;
X_SQL := X_SQL || ' , A.PROG_STATUS AS PROG_STATUS_TMP ' || CHR(13) ; -- 견적 진행상태
X_SQL := X_SQL || ' , A.MEAL_TYPE ' || CHR(13) ;
X_SQL := X_SQL || ' , A.EST_PERIOD_GBN ' || CHR(13) ;
X_SQL := X_SQL || ' , A.UNIT_WEIGHT ' || CHR(13) ; -- 현품설명의 단위중량
X_SQL := X_SQL || ' , ( ' || CHR(13) ;
X_SQL := X_SQL || X_SQL_01 || CHR(13) ;
X_SQL := X_SQL || ' ) AS QTY ' || CHR(13) ;
X_SQL := X_SQL || ' , A.PRICE ' || CHR(13) ;
X_SQL := X_SQL || X_SQL_02 || CHR(13) ;
.... (생략)