create table hrsa_special_add_deduction
(
id                        NUMBER(38, 0) primary key,
employee_id               NUMBER(38, 0) not null,
tax_agent_id              NUMBER(38, 0) not null,
children_education        varchar2(255) default '' ,
continuing_education      varchar2(255) default '' ,
housing_loan_interest     varchar2(255) default '' ,
housing_rent              varchar2(255) default '',
supporting_elder          varchar2(255) default '' ,
serious_illness_treatment varchar2(255) default '' ,
infant_care               varchar2(255) default '',
create_time               DATE   DEFAULT sysdate,
update_time               DATE   DEFAULT sysdate,
creator                   NUMBER(38, 0),
delete_type               NUMBER(11, 0)      default 0  ,
tenant_key                varchar2(10)  default ''
);
/

create sequence hrsa_special_a_d_id
start with 1
increment by 1
nomaxvalue
nocycle
nocache;
/

CREATE TRIGGER hrsa_spec_add_dct_trigger
before INSERT ON hrsa_special_add_deduction FOR each ROW WHEN (new.id IS NULL)
BEGIN
SELECT hrsa_special_a_d_id.nextval into:New.id from dual;
END;
/

CREATE TRIGGER hrsa_spec_add_dct_time_trigger
before UPDATE ON hrsa_special_add_deduction FOR each ROW WHEN (new.update_time IS NOT NULL)
BEGIN
SELECT sysdate into:new.update_time from dual;
END;
/