[existKey]
select 1 from m_sir
where sir_cd = ':sir_cd'
;
[get_new_cd]
select max(sir_cd::numeric) + :msir_auto::numeric as newcd
from m_sir
;

[delete_wk]
delete from w_basr0030
where 1=1
and s_id = :s_id

[insert_wk]
--insert into w_basr0030(s_id, tok_cd, del_flg, cre_id, cre_time, upd_id, upd_time)
--values(:s_id, ':tok_cd', 0, ':login_id', now(), ':login_id', now())
insert into w_basr0030(s_id, seikyu_ymd, tok_cd, del_flg, cre_id, cre_time, upd_id, upd_time)
values(:s_id, ':seikyu_ymd', ':sir_cd', 0, ':login_id', now(), ':login_id', now())
;

[get_kaikake_Info]
select seikyu_zan as _seikyu_zan, syukin_gaku as _syukin_gaku, zeikomi_gaku as _zeikomi_gaku, seikyu_ymd as _seikyu_ymd
,(coalesce(seikyu_zan,0) + coalesce(zeikomi_gaku,0))- coalesce(syukin_gaku,0) as _kake_zan
from v_kaikake_zan
where sir_cd = ':sir_cd'
;

[load_grdList_disc]
select ':sir_cd' as sir_cd, han.han_cd as cat_cd, han.han_name, m.disc_per
from m_hanyo han
left join m_sir_disc m on (han.han_cd = m.cat_cd and m.sir_cd = ':sir_cd')
where han.mst_kbn = '05'
;

[load_grdList_doc]
SELECT s_id,row_no,file_name
FROM w_den_atch
where s_id = :s_id
order by row_no
;

[doc_sort]
select fnc_update_file_image_sort(:s_id);


[delete_disc]
delete from m_sir_disc
where sir_cd = ':sir_cd'
;


[deleteDocRow]
delete from w_den_atch where s_id = :s_id and row_no = :d_row_no;

[getDocs]
select file_image from w_den_atch
where s_id = :s_id
and row_no = :_row_no
;

[update_atch]
select fnc_update_sir_atch(:s_id, ':sir_cd');

[load_atch]
select fnc_load_sir_atch(:s_id, ':sir_cd');