SELECT CCTV_MNGM_NMBR,         
       CCTV_CTLR_ID,           
       CCTV_CTLR_IP,           
       CCTV_CTLR_PORT,         
       CCTV_CAPT_IP,           
       CCTV_CAPT_PORT,         
       CCTV_FIBR_IP,           
       CCTV_ENCD_IP,           
       STRM_SVR_IP,            
       STRM_SVR_PORT,          
       STRM_SESN_NM,           
       NVL(X_CRDN, 0) X_CRDN,  
       NVL(Y_CRDN, 0) Y_CRDN,  
       ISTL_LCTN_NM,           
       ISTL_LCTN_ADDR,         
       CCTV_CHNL,              
       DEL_YN,                 
       FRST_REGR_NMBR,         
       FRST_RGST_DT,           
       LAST_CRPR_NMBR,         
       LAST_CRCT_DT,           
       LINK_ID,                
       CCTV_ID,                
       RELY_PORT,              
       STRM_RTSP_ADDR,         
       STRM_RTMP_ADDR,         
       STRM_HTTP_ADDR          
  FROM TB_CCTV_CTLR            
 WHERE DEL_YN = 'N'    
 

-- 등록 시설물
SELECT 'CCTV' AS FAC_TYPE, CCTV_CTLR_ID AS FAC_ID, ISTL_LCTN_NM AS FAC_NM, DEL_YN 
  FROM TB_CCTV_CTLR                                                               
 WHERE DEL_YN = 'N'                                                               

--시설물 상태
SELECT 'CCTV' AS FAC_TYPE, CCTV_MNGM_NMBR AS FAC_ID, 
       DECODE(CMNC_STTS_CD, 'CMS0', '1', 'CMS1', '0', '2') AS COMM,
       DECODE(CBOX_DOOR_STTS_CD, 'CDS0', '0', 'CDS1', '1', '2') AS DOOR
  FROM TB_CCTV_STTS 
 WHERE UPDT_DT >= TO_CHAR(SYSDATE-2/1440, 'YYYYMMDDHH24MISS')
