CREATE OR REPLACE FUNCTION insert_r_shukkin()
  RETURNS trigger AS $$
begin
insert into dat_rd_shukkin (
rirekino
,sakujofg
,shukkinno
,shukkinbi
,shiiresakicd
,projectcd
,biko
,shanaibiko
,tantoshaid
,bushocd
,shoninnichiji
,shoninshaid
,sakuseiuserid
,sakuseinichiji
,koshinuserid
,koshinnichiji
  ) values (
nextval('sqns_shukkinrirekino')
,false
,new.shukkinno
,new.shukkinbi
,new.shiiresakicd
,new.projectcd
,new.biko
,new.shanaibiko
,new.tantoshaid
,new.bushocd
,new.shoninnichiji
,new.shoninshaid
,new.sakuseiuserid
,new.sakuseinichiji
,new.koshinuserid
,new.koshinnichiji
  );
insert into dat_rm_shukkin (
rirekino
,shukkinno
,gyono
,oyameisaicd
,meisaicd
,meisaikb
,kessaikb
,shukkinkb
,shukkinkingaku
,kazeikb
,shohizeiritsu
,shohizeigaku
,kozacd
,tegatabango
,tegatafuridashibasho
,tegatafuridashibi
,tegatamankibi
,biko
,shanaibiko
,shukkinkarikatakamokucd
,shukkinkashikatakamokucd
,sakuseiuserid
,sakuseinichiji
,koshinuserid
,koshinnichiji
) select
currval('sqns_shukkinrirekino')
,ms.shukkinno
,ms.gyono
,ms.oyameisaicd
,ms.meisaicd
,ms.meisaikb
,ms.kessaikb
,ms.shukkinkb
,ms.shukkinkingaku
,ms.kazeikb
,ms.shohizeiritsu
,ms.shohizeigaku
,ms.kozacd
,ms.tegatabango
,ms.tegatafuridashibasho
,ms.tegatafuridashibi
,ms.tegatamankibi
,ms.biko
,ms.shanaibiko
,ms.shukkinkarikatakamokucd
,ms.shukkinkashikatakamokucd
,ms.sakuseiuserid
,ms.sakuseinichiji
,ms.koshinuserid
,ms.koshinnichiji
from dat_m_shukkin ms
where ms.shukkinno = new.shukkinno
;
return new;
end;
$$
LANGUAGE plpgsql;
