안녕하세요.
오라클 쿼리를 문의드립니다.
SELECT /* r1100hdscm_w_etax_ezcont_broad_d_etax_trans_08_main3_list */ --S_CSAGREELIST
CC.CONT_NUMB AS CONT_NUMB,
TO_CHAR(AA.BD_DATE, 'yyyy-mm-dd') AS BD_DATE,
TO_CHAR(AA.BD_BTIME, 'yyyy-mm-dd hh24:mi') AS BD_BTIME,
TO_CHAR(BB.BD_BTIME, 'yyyy-mm-dd hh24:mi') AS BBBD_BTIME,
AA.PROG_NAME AS PROG_NAME,
AA.DEPT_CODE AS DEPT_CODE,
F_TEC_GETDEPTNAME('2000', AA.DEPT_CODE) DEPT_NAME1,
F_TEC_GETDEPTNAME('3000', AA.DEPT_CODE) DEPT_NAME2,
AA.MD_CODE AS MD_CODE,
AA.MD_NAME AS MD_NAME,
AA.VEN_CODE AS VEN_CODE,
EE.VEN_NAME AS VEN_NAME,
F_TEC_GETADMINNAME((SELECT SIGN_USER_ID FROM TEC_CONT_CORP WHERE CONT_NUMB=CC.CONT_NUMB AND CONT_CHNG_NUMB=CC.CONT_CHNG_NUMB
AND CONT_CUST_GBN='100' AND CONT_CUST_SEQ='1')) AS A_SIGN_USER_ID,
TO_CHAR(CC.INSERT_DATE, 'YYYY-MM-DD HH24:MI') AS CONT_DATE,
F_TEC_GETSIGNDATE(CC.CONT_NUMB,'100') AS A_SIGN_DATE,
F_TEC_GETSIGNDATE(CC.CONT_NUMB,'110') AS B_SIGN_DATE,
TO_CHAR(CC.MODIFY_DATE, 'yyyy-mm-dd hh24:mi') AS DT_UPDATE,
'합의서' AS FORM_FILENAME,
'미작성' AS STATUS_NAME,
'100' AS CONT_PROC_STAT,
--DECODE(CC.CONT_PROC_STAT, '100', '계약통지', '200', '계약서작성중', '300', '계약확인', '400', '현대서명예정', '500', '업체서명예정', '600', '계약완료', '700', '수기완료', '800', '계약폐기', '900', '중복삭제', '미작성') AS STATUS_NAME,
'3' AS CONT_KIND,
'' modify_status,
'' chk2
FROM
(
SELECT /*+ index (B pk_titem) */
C.DEPT_CODE AS DEPT_CODE,
C.MD_CODE AS MD_CODE,
C.MD_NAME AS MD_NAME,
A.PROG_CODE AS PROG_CODE,
A.BD_DATE AS BD_DATE,
A.BD_BTIME AS BD_BTIME,
B.VEN_CODE AS VEN_CODE,
D.PROG_NAME
FROM
TDTBROAD A,
TITEM B,
TMD C,
TPROGRAM D
WHERE
A.ITEM_CODE = B.ITEM_CODE
AND B.MD_CODE = C.MD_CODE
AND A.PROG_CODE = D.PROG_CODE
AND A.BD_DATE < TRUNC(SYSDATE) + 12
AND NVL(A.LIVE_YN, '1') = '1'
AND A.BD_DATE >= '20080629'
AND A.BD_DATE <= '20080729'
GROUP BY C.DEPT_CODE, C.MD_CODE, C.MD_NAME, A.PROG_CODE, D.PROG_NAME, A.BD_DATE, A.BD_BTIME, B.VEN_CODE
) AA,
TEC_BROADCASTLIST BB,
TEC_CONT_MASTER CC,
VENDOR EE
WHERE
AA.PROG_CODE = BB.PROG_CODE (+)
AND AA.BD_DATE = BB.BD_DATE (+)
--$WHERE33$
AND AA.VEN_CODE = BB.VEN_CODE (+)
AND BB.BROD_INDEX = CC.BROD_INDEX (+)
AND AA.VEN_CODE = EE.VEN_CODE(+)
AND CC.PRE_CONT_FLAG(+) = 'N'
AND AA.A_SIGN_DATE IS NULL
AND AA.B_SIGN_DATE IS NULL
ORDER BY AA.BD_BTIME
현재 이쿼리가.여러군데의 테이블의 컬럼을 가지고 와서 값들을 출력하는 쿼리 입니다.
이쿼리에서 제일 밑에 빨강색으로 체크 해놓은 부분을 추가 하고 싶은데요. 어떻게 해야할지..도통되질 않아서 이렇게 문의를 드립니다.
밑에 추가 해놓은 것처럼 그냥 추가하면 잘못된 식별자라고 오류가 뜨고. AA.이라는걸 빼도 식별자를 찾을수 없다는 오류가 나옵니다...
A_SIGN_DATE 이 알리안스들은 오라클에서 펑션을 사용해서 값을 가지고 온걸 이 알리안스에 넣어주는데 어떻게 해야 이 알리안스를 사용하면서 조건을 넣을수 있는지 문의를 드립니다...