;是执行语句必须的
/是执行语句块必须的
比如执行一个触发器
CREATE OR REPLACE TRIGGER "TRG_1" BEFORE INSERT ON "CATEGORY" REFERENCING OLD AS "OLD" NEW AS "NEW" FOR EACH ROW ENABLE
DECLARE
v_newVal NUMBER(12) := 0;
v_incval NUMBER(12) := 0;
BEGIN
IF INSERTING AND :new.catid IS NULL THEN
SELECT catid_seq.NEXTVAL INTO v_newVal FROM DUAL;
IF v_newVal = 1 THEN
SELECT NVL(max(catid),0) INTO v_newVal FROM category;
v_newVal := v_newVal + 1;
LOOP
EXIT WHEN v_incval>=v_newVal;
SELECT catid_seq.nextval INTO v_incval FROM dual;
END LOOP;
END IF;
:new.catid := v_newVal;
END IF;
END;
/
CREATE OR REPLACE TRIGGER "TRG_1" BEFORE INSERT ON "CATEGORY" REFERENCING OLD AS "OLD" NEW AS "NEW" FOR EACH ROW ENABLE
DECLARE
v_newVal NUMBER(12) := 0;
v_incval NUMBER(12) := 0;
BEGIN
IF INSERTING AND :new.catid IS NULL THEN
SELECT catid_seq.NEXTVAL INTO v_newVal FROM DUAL;
IF v_newVal = 1 THEN
SELECT NVL(max(catid),0) INTO v_newVal FROM category;
v_newVal := v_newVal + 1;
LOOP
EXIT WHEN v_incval>=v_newVal;
SELECT catid_seq.nextval INTO v_incval FROM dual;
END LOOP;
END IF;
:new.catid := v_newVal;
END IF;
END;
/