create table HRSA_SALARY_SEND_RANGE
(
    ID             NUMBER(38) not null
        primary key,
    SALARY_SEND_ID NUMBER(38),
    GRANT_TYPE     VARCHAR2(64),
    CREATE_TIME    TIMESTAMP(6) default sysdate,
    CREATOR        NUMBER(38),
    UPDATE_TIME    TIMESTAMP(6) default sysdate,
    DELETE_TYPE    NUMBER(11)   default 0,
    TENANT_KEY     VARCHAR2(10)
);
/

create sequence HRSA_S_S_R_ID
start with 1
increment by 1
MAXVALUE 9223372036854775807
nocycle
nocache;
/

CREATE TRIGGER HRSA_S_S_R_TRIGGER
before INSERT ON HRSA_SALARY_SEND_RANGE FOR each ROW WHEN (NEW.ID IS NULL)
BEGIN
SELECT HRSA_S_S_R_ID.nextval into:NEW.ID from dual;
END;
/

create table HRSA_SALARY_SEND_RANGE_OBJ
(
    ID                   NUMBER(38) not null
        primary key,
    SALARY_SEND_ID       NUMBER(38) not null,
    SALARY_SEND_RANGE_ID NUMBER(38) not null,
    RANGE_TYPE           NUMBER(11) not null,
    TARGET_TYPE          NUMBER(11) not null,
    TARGET_ID            NUMBER(38) not null,
    CREATOR              NUMBER(38),
    CREATE_TIME          DATE default sysdate,
    UPDATE_TIME          DATE default sysdate,
    DELETE_TYPE          NUMBER(11)   default 0,
    TENANT_KEY           VARCHAR2(10)
);
/

create sequence HRSA_S_S_R_O_ID
start with 1
increment by 1
MAXVALUE 9223372036854775807
nocycle
nocache;
/

CREATE TRIGGER HRSA_S_S_R_O_TRIGGER
before INSERT ON HRSA_SALARY_SEND_RANGE_OBJ FOR each ROW WHEN (NEW.ID IS NULL)
BEGIN
SELECT HRSA_S_S_R_O_ID.nextval into:NEW.ID from dual;
END;
/