[loadOriginal]
select fnc_load_basv0640(:s_id, :den_no)

[updateOriginal]
select fnc_update_basv0640(:s_id)

[deleteOriginal]
delete from w_basv0640 where s_id = :s_id;
delete from w_basv0640_m where s_id = :s_id;

[doDelete]
select fnc_delete_basv0640(:den_no, ':login_id')

[getOtherId]
select other_id as w_other_id
from m_hin
where hin_cd = ':w_hin_cd'

[getMaxDenNo]
select
  (select max(den_no) from m_saiban where saiban_kbn = 7) as last_den_no

[loadNewKey]
select den_no as w_new_den_no
from w_basv0640
where s_id = :s_id

[loadSir]
insert into w_basv0640_m (
  s_id
, row_no
, hin_cd
, hin_nm
, suryo
, kakutei_flg
, del_flg
, cre_id
, cre_time
, upd_id
, upd_time
)
select
  :s_id
, sm.row_no
, sm.hin_cd
, mh.hin_rnm
, sm.suryo
--#19308 2021.11.15 MOD STT
--, 0 --kakutei_flg
, 1 --kakutei_flg
--#19308 2021.11.15 MOD END
, 0 --del_flg
, ':login_id' --cre_id
, now() --cre_time
, ':login_id' --upd_id
, now() --upd_time
from t_sir_m sm
inner join v_m_hin mh on (mh.hin_cd = sm.hin_cd)
where sm.den_no = :sir_no
order by sm.row_no

[loadUri]
insert into w_basv0640_m (
  s_id
, row_no
, hin_cd
, hin_nm
, suryo
, kakutei_flg
, del_flg
, cre_id
, cre_time
, upd_id
, upd_time
)
select
  :s_id
, um.row_no
, um.hin_cd
, mh.hin_rnm
, um.suryo
--#19308 2021.11.15 MOD STT
--, 0 --kakutei_flg
, 1 --kakutei_flg
--#19308 2021.11.15 MOD END
, 0 --del_flg
, ':login_id' --cre_id
, now() --cre_time
, ':login_id' --upd_id
, now() --upd_time
from t_uri_m um
inner join v_m_hin mh on (mh.hin_cd = um.hin_cd)
where um.den_no = :uri_no
order by um.row_no




