Obsidian/Recognition/Work Related/프로젝트/D-MHFH/유지보수/MSG Test SQL.md

3.3 KiB

수동위치보고 테스트(DEV)

-- 특정선박 입/출항 시각 조정
SELECT * 
FROM V_ARS_INOUT2
WHERE SHIP_NO = '00020016267100'


-- 자료 생성 : TB_LC_FSHOPRRPT_20yyMM
--INSERT INTO TB_LC_FSHOPRRPT_202205
--SELECT *
--FROM TB_LC_FSHOPRRPT_202112
--WHERE SLOT_NO IN ( '306', '207' )
--AND to_char(INSERT_DT, 'yyyymmdd') LIKE '2021122%'



SELECT sysdate FROM dual

-- TB_LAST_LC.REPORT_DT 수정
SELECT *
FROM TB_LAST_LC ts 
WHERE SLOT_NO IN ( '306', '207' )

-- TB_LC_FSHOPRRPT_20yyMM.REPORT_DT 수정
SELECT *
FROM TB_LC_FSHOPRRPT_202206
WHERE SLOT_NO IN ( '306', '207' )
ORDER BY 2 DESC


---------------------------------------1-------------------------
UPDATE TB_LAST_LC 
SET REPORT_DT = sysdate - INTERVAL '9' HOUR - INTERVAL '10' MINUTE
WHERE SLOT_NO IN ( '306', '207' ) 

UPDATE TB_LC_FSHOPRRPT_202206 
SET REPORT_DT = sysdate - INTERVAL '9' HOUR - INTERVAL '10' MINUTE
WHERE SLOT_NO IN ( '306', '207' ) 

DELETE 
FROM TB_PASSIVLC_REQUST
WHERE SLOT_NO IN ( '306', '207' )
AND to_char(INSERT_DT, 'yyyymmdd') LIKE '20220602%' 

----------------------------------------------------------------


-- 요청데이터 확인(행 삭제)
SELECT *
FROM TB_PASSIVLC_REQUST
WHERE SLOT_NO IN ( '306', '207' )
AND to_char(INSERT_DT, 'yyyymmdd') LIKE '20220603%' 
ORDER BY INSERT_DT 



-- 일자 UTC 확인
-- 2022-05-03 14:10:01.000
SELECT (to_date('2022-05-12 16:18:01', 'yyyy-mm-dd hh24:mi:ss') - INTERVAL '9' HOUR) FROM dual

SELECT (to_date('2022-05-16 13:20:00', 'yyyy-mm-dd hh24:mi:ss') - INTERVAL '9' HOUR) FROM dual

SELECT (sysdate - INTERVAL '9' HOUR) FROM dual

어선안전조업DB 출입항 상태 확인(GICOMSDW)

-- 어선안전조업DB 선박 출입항 정보
SELECT a.call_sign, b.inout_part, b.OUT_port_day, b.OUT_port_time, a.ship_no, a.slot_no
FROM TACEEZ.V_ARS_SHIP@TACEEZ_LINK A
 , TACEEZ.V_ARS_INOUT2@TACEEZ_LINK b
WHERE a.ship_no = b.ship_no
AND a.CALL_SIGN = b.call_sign
AND a.slot_no IS NOT NULL 
AND a.use_yn = 'Y'
AND a.slot_no IN ( '306', '207' )

20220602 1001   58.000

-- 출입항 이력
SELECT *
FROM TACEEZ.TB_FBB_TKOFF@TACEEZ_LINK a 
WHERE call_smbol = '801동순'
AND tkoff_de LIKE '20220223' 
--AND fshrbt_no = '03100016421501'


SELECT *
FROM TACEEZ.V_ARS_INOUT2
WHERE SHIP_NO IN ('12080036488408')

20220530 0812

SELECT  to_char(to_date(:ar_ddd, 'yyyymmddhh24miss') - INTERVAL '30' MINUTE , 'yyyymmddhh24mi') FROM dual

SELECT ts.SLOT_NO
     , (to_date(vai.OUT_PORT_DAY||vai.OUT_PORT_TIME, 'yyyy-mm-dd hh24:mi:ss') - INTERVAL '9' HOUR ) AS REPORT_DT 
     , '' AS modem1
     , '' AS modem2
     , '' AS modem3
     , '12' AS mssage_ty
     , to_date(:ar_ddd, 'yyyymmddhh24miss') -INTERVAL '9' HOUR AS UTC_NOW_DT
     , 4 as chk_gbn
FROM TACEEZ.V_ARS_SHIP@TACEEZ_LINK ts, TACEEZ.V_ARS_INOUT2@TACEEZ_LINK vai
WHERE ts.SHIP_NO = vai.SHIP_NO
AND ts.SLOT_NO IS NOT null
AND vai.inout_part = 'O'                     /* 중단파DB시간 기준으로 조회 */
AND vai.OUT_PORT_DAY||vai.OUT_PORT_TIME >= ( to_char(to_date(:ar_ddd, 'yyyymmddhh24miss') - INTERVAL '4' HOUR , 'yyyymmddhh24mi') ) 
AND vai.OUT_PORT_DAY||vai.OUT_PORT_TIME <= ( to_char(to_date(:ar_ddd, 'yyyymmddhh24miss') - INTERVAL '10' MINUTE , 'yyyymmddhh24mi')) 
and ts.SLOT_NO not in( 306 )
ORDER BY REPORT_DT ASC

출입항상태 수정(TEST155)

SELECT *
FROM TACEEZ.V_ARS_INOUT2
WHERE SHIP_NO IN ('04090016265002','00020016267100')