SELECT VMS_CTLR_NMBR,              
       VMS_ID,                     
       VMS_CTLR_ID,                
       VMS_NM,                     
       VMS_CTLR_IP,                
       VMS_USAG_TYPE_CD,           
       VMS_FRM_TYPE_CD,            
       VMS_TYPE_CD,                
       VMS_MODL_TYPE_CD,           
       VMS_CMNC_PORT,              
       OPER_MODE,                  
       VMS_CMNC_ERR_BASS_VAL,      
       VMS_NGHT_BRGH_STEP,         
       VMS_WEEK_BRGH_STEP,         
       VMS_PHSE_CHNG_CYCL,         
       VMS_MODL_ERR_RATE,          
       CMNCFAIL_SLOT_NMBR,         
       PWER_FAIL_SLOT_NMBR,        
       DEL_YN,                     
       CMTRINFR_CNCT_YN,           
       WTHRINFR_CNCT_YN,           
       ENVRINFR_CNCT_YN,           
       VMS_MAX_PHSE_NUM,           
       FRST_REGR_NMBR,             
       FRST_RGST_DT,               
       LAST_CRPR_NMBR,             
       LAST_CRCT_DT,               
       PANL_ON_TIME,               
       PANL_OFF_TIME,              
       PANL_PWER_MODE,             
       BRGH_MODE,                  
       WEB_CMRA_IP,                
       NVL(X_CRDN, 0) X_CRDN,      
       NVL(Y_CRDN, 0) Y_CRDN,      
       ISTL_LCTN_NM,               
       TRFC_STRG_USE_YN,           
       VMS_LOC_IFSC_ID             
  FROM TB_VMS_CTLR                 
 WHERE DEL_YN = 'N'          
 
 
-- 등록 시설물
SELECT 'VMS'  AS FAC_TYPE, VMS_CTLR_ID  AS FAC_ID, VMS_NM       AS FAC_NM, DEL_YN 
  FROM TB_VMS_CTLR                                                                
 WHERE DEL_YN = 'N'                                                               

--시설물 상태
SELECT 'VMS' AS FAC_TYPE, VMS_CTLR_NMBR AS FAC_ID, 
       DECODE(CONN_STTS_CD, 'CMS0', '1', 'CMS1', '0', '2') AS COMM,
       DECODE(CBOXDOOR_OPEN_STTS_CD, 'CDS0', '0', 'CDS1', '1', '2') AS DOOR
  FROM TB_VMS_STTS_PRST 
 WHERE RGST_DT >= TO_CHAR(SYSDATE-2/1440, 'YYYYMMDDHH24MISS')
