CREATE OR REPLACE FUNCTION insert_r_ukeharai()
  RETURNS trigger AS $$
begin
insert into dat_rd_ukeharai (
rirekino
,sakujofg
,ukeharaino
,uriageno
,shiireno
,ukeharaibi
,projectcd
,biko
,shanaibiko
,tantoshaid
,bushocd
,shoninnichiji
,shoninshaid
,denpyosakuseikb
,sakuseiuserid
,sakuseinichiji
,koshinuserid
,koshinnichiji
  ) values (
nextval('sqns_ukeharairirekino')
,false
,new.ukeharaino
,new.uriageno
,new.shiireno
,new.ukeharaibi
,new.projectcd
,new.biko
,new.shanaibiko
,new.tantoshaid
,new.bushocd
,new.shoninnichiji
,new.shoninshaid
,new.denpyosakuseikb
,new.sakuseiuserid
,new.sakuseinichiji
,new.koshinuserid
,new.koshinnichiji
  );
insert into dat_rm_ukeharai (
rirekino
,ukeharaino
,gyono
,oyameisaicd
,meisaicd
,meisaikb
,hinmokucd
,hinmokumei
,kikaku
,kataban
,lotno
,seizobi
,shohikigen
,suryo
,tanicd
,zaikotanka
,zaikokingaku
,biko
,shanaibiko
,shukkosokocd
,shukkolocationcd
,nyukosokocd
,nyukolocationcd
,ukeharaikarikatakamokucd
,ukeharaikashikatakamokucd
,sakuseiuserid
,sakuseinichiji
,koshinuserid
,koshinnichiji
) select
currval('sqns_ukeharairirekino')
,mu.ukeharaino
,mu.gyono
,mu.oyameisaicd
,mu.meisaicd
,mu.meisaikb
,mu.hinmokucd
,mu.hinmokumei
,mu.kikaku
,mu.kataban
,mu.lotno
,mu.seizobi
,mu.shohikigen
,mu.suryo
,mu.tanicd
,mu.zaikotanka
,mu.zaikokingaku
,mu.biko
,mu.shanaibiko
,mu.shukkosokocd
,mu.shukkolocationcd
,mu.nyukosokocd
,mu.nyukolocationcd
,mu.ukeharaikarikatakamokucd
,mu.ukeharaikashikatakamokucd
,mu.sakuseiuserid
,mu.sakuseinichiji
,mu.koshinuserid
,mu.koshinnichiji
from dat_m_ukeharai mu
where mu.ukeharaino = new.ukeharaino
;
return new;
end;
$$
LANGUAGE plpgsql;
