CREATE OR REPLACE FUNCTION insert_r_uriage()
  RETURNS trigger AS $$
begin
insert into dat_rd_uriage (
rirekino
,sakujofg
,uriageno
,juchuno
,uriagebi
,tokuisakicd
,tokuisakiatena
,projectcd
,biko
,shanaibiko
,tantoshaid
,bushocd
,tankarankcd
,shoninnichiji
,shoninshaid
,seikyuyoteibi
,nyukinyoteibi
,kessaikb
,denpyosakuseikb
,sakuseiuserid
,sakuseinichiji
,koshinuserid
,koshinnichiji
  ) values (
nextval('sqns_uriagerirekino')
,false
,new.uriageno
,new.juchuno
,new.uriagebi
,new.tokuisakicd
,new.tokuisakiatena
,new.projectcd
,new.biko
,new.shanaibiko
,new.tantoshaid
,new.bushocd
,new.tankarankcd
,new.shoninnichiji
,new.shoninshaid
,new.seikyuyoteibi
,new.nyukinyoteibi
,new.kessaikb
,new.denpyosakuseikb
,new.sakuseiuserid
,new.sakuseinichiji
,new.koshinuserid
,new.koshinnichiji
  );
insert into dat_rm_uriage (
rirekino
,uriageno
,gyono
,oyameisaicd
,meisaicd
,meisaikb
,hinmokucd
,hinmokumei
,kikaku
,kataban
,lotno
,nisugatacd
,suryo
,tanicd
,teika
,tanka
,kazeikb
,shohizeiritsu
,choseishohizeigaku
,kingaku
,noki
,biko
,shanaibiko
,uriagekarikatakamokucd
,uriagekashikatakamokucd
,sakuseiuserid
,sakuseinichiji
,koshinuserid
,koshinnichiji
) select
currval('sqns_uriagerirekino')
,mu.uriageno
,mu.gyono
,mu.oyameisaicd
,mu.meisaicd
,mu.meisaikb
,mu.hinmokucd
,mu.hinmokumei
,mu.kikaku
,mu.kataban
,mu.lotno
,mu.nisugatacd
,mu.suryo
,mu.tanicd
,mu.teika
,mu.tanka
,mu.kazeikb
,mu.shohizeiritsu
,mu.choseishohizeigaku
,mu.kingaku
,mu.noki
,mu.biko
,mu.shanaibiko
,mu.uriagekarikatakamokucd
,mu.uriagekashikatakamokucd
,mu.sakuseiuserid
,mu.sakuseinichiji
,mu.koshinuserid
,mu.koshinnichiji
from dat_m_uriage mu
where mu.uriageno = new.uriageno
;
return new;
end;
$$
LANGUAGE plpgsql;
