CREATE OR REPLACE TRIGGER TRI_CASIC_USERDOCUMENT
  BEFORE INSERT ON CASIC_USERDOCUMENT
  FOR EACH ROW


when (NEW.DBID IS NULL)
BEGIN
  SELECT SEQ_CASIC_USERDOCUMENT_ID.NEXTVAL INTO :NEW.DBID FROM DUAL;
END;