Obsidian/Recognition/Work Related/프로젝트/스마트계류장/1.데이터베이스/EAI 프로시져 테스트.md

93 lines
2.5 KiB
Markdown
Raw Normal View History

2024-04-12 09:43:44 +00:00
```sql
CREATE OR REPLACE PROCEDURE UIC.PROC_Test_CURSOR_Before
IS
n_cnt NUMBER(10);
/* 처리 대상 데이터 조회용 커서 */
CURSOR C_IF_TEST IS
select IF_SRC, IF_DT
from (
select 'ARTS_ARR' as IF_SRC, DATEANDTIME as IF_DT
from ueai.EAI_ELECSTRIPARRARTS_RCV_TEST
where DEAL_STAT = 'T'
union all
select 'ARTS_DEP' as IF_SRC, DATEANDTIME as IF_DT
from ueai.EAI_ELECSTRIPDEPARTS_RCV_TEST
where DEAL_STAT = 'T'
union all
select 'A-CDM_ARR' as IF_SRC, DATEANDTIME as IF_DT
from ueai.EAI_FLTACDMMLSTNARR_RCV_TEST
where DEAL_STAT = 'T'
union all
select 'A-CDM_DEP' as IF_SRC, DATEANDTIME as IF_DT
from ueai.EAI_FLTACDMMLSTNDEP_RCV_TEST
where DEAL_STAT = 'T'
union all
select 'GAM' as IF_SRC, DATEANDTIME as IF_DT
from ueai.EAI_GRDACMVT_RCV_TEST
where DEAL_STAT = 'T'
)
where if_dt < '20231219000000.000'
order by if_dt, if_src;
BEGIN
FOR cur IN C_IF_TEST LOOP
IF cur.IF_SRC = 'ARTS_ARR' THEN
update ueai.EAI_ELECSTRIPARRARTS_RCV_TEST
set deal_stat = 'S'
where dateandtime = cur.IF_DT;
UIC.PROC_EAI_INTRFC_ARTS_ARR_edit();
ElsIF cur.IF_SRC = 'ARTS_DEP' THEN
update ueai.EAI_ELECSTRIPDEPARTS_RCV_TEST
set deal_stat = 'S'
where dateandtime = cur.IF_DT;
UIC.PROC_EAI_INTRFC_ARTS_DEP_Edit();
ElsIF cur.IF_SRC = 'A-CDM_ARR' THEN
update ueai.EAI_FLTACDMMLSTNARR_RCV_TEST
set deal_stat = 'S'
where dateandtime = cur.IF_DT;
UIC.PROC_EAI_INTRFC_ACDM_ARR_Edit();
ElsIF cur.IF_SRC = 'ARTS_ARR' THEN
update ueai.EAI_ELECSTRIPDEPARTS_RCV_TEST
set deal_stat = 'S'
where dateandtime = cur.IF_DT;
PROC_EAI_INTRFC_ACDM_DEP_EDIT();
ElsIF cur.IF_SRC = 'GAM' THEN
update ueai.EAI_GRDACMVT_RCV_TEST
set deal_stat = 'S'
where dateandtime = cur.IF_DT;
UIC.PROC_EAI_INTRFC_GAM_EDIT();
END IF;
END LOOP;
RETURN;
EXCEPTION WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('PROC_Test_CURSOR-'||'['||SQLERRM||']');
RETURN ;
END;
```