日期:2014-05-17 浏览次数:20861 次
create or replace trigger insert_out_user after delete on employee for each row declare v_num number; begin select count(*) into v_num from out_employee; insert into out_employee values ( v_num + 1, :old.u_name, :old.u_entry_time, sysdate, 此字段就是通过两时间相减得到的值。该怎么写,谢谢各位大神……, :old.u_department, :old.u_post, :old.u_sex, :old.u_age, :old.u_phone ); end insert_out_user;
create or replace trigger insert_out_user after delete on employee for each row declare v_num number; v_year varchar2(20); begin select count(*) into v_num from out_employee; SELECT replace(trunc(months_between(a,b)/12,1),'.','年')||'月' into v_year FROM ( SELECT trunc(to_date('2011-11-10 18:54:25','yyyy-mm-dd hh24:mi:ss'),'mm')a, trunc(to_date('2008-12-10','yyyy-mm-dd'),'mm') b FROM dual ); insert into out_employee values ( v_num + 1, :old.u_name, :old.u_entry_time, v_year; :old.u_department, :old.u_post, :old.u_sex, :old.u_age, :old.u_phone ); end insert_out_user;