create sequence SEQ_LoanApplicantGuarantee
minvalue 1
nomaxvalue
start with 1
increment by 1
nocycle
nocache;
CREATE OR REPLACE TRIGGER TRI_LoanApplicantGuarantee
BEFORE INSERT ON LoanApplicantGuarantee FOR EACH ROW WHEN (new.GuaranteeID is null)
begin
select SEQ_LoanApplicantGuarantee.nextval into:new.GuaranteeID from dual;
end;
以上SQL成功创建了序列并用Trigger将其与表绑定在了一起