CREATE OR REPLACE TRIGGER TR_INPATIENTINFO_BINS BEFORE INSERT ON INPATIENTINFO REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW begin if inserting then if :new.RecordFlow is null then --序号 select SQ_InPatientInfo_RecordFlow.nextval into :new.RecordFlow from dual where rownum=1; end if; end if; Exception when others then raise_application_error(-20002,substr(nvl(sqlerrm, '原因不明出错')||'!*',1,220)); End tr_InPatientInfo_bins; /