入门着怎样建一个普通的触发器

来源:互联网 发布:easymule 软件 编辑:程序博客网 时间:2024/05/01 08:34
CREATE OR REPLACE TRIGGER TBL_AREA_TRIGGER --触发器名

    BEFORE INSERT

    ON TBL_AREA--表名

    FOR EACH ROW


DECLARE

  next_id NUMBER;

BEGIN

  --Get the next id number from the sequence

  SELECT hibernate_sequence.NEXTVAL  --sequence名

  INTO next_id

  FROM dual;

  --Use the sequence number as the primary key

  --for the record being inserted.

  :new.AREA_ID := next_id;--表的ID名

END;
原创粉丝点击