sourceforge2.5oci8-trigger_auto.sql

来自「GForge 3.0 协作开发平台 支持CVS, mailing lists, 」· SQL 代码 · 共 1,401 行 · 第 1/3 页

SQL
1,401 行
字号
/CREATE OR REPLACE TRIGGER A_snippet_pk_seq        BEFORE INSERT OR UPDATE of snippet_id        ON snippet FOR EACH ROWBEGIN        IF (:new.snippet_id is null) then          IF INSERTING THEN            SELECT snippet_pk_seq.nextval INTO :new.snippet_id FROM DUAL;          ELSIF UPDATING THEN            :new.snippet_id := :old.snippet_id;          END IF;        END IF;END;/CREATE OR REPLACE TRIGGER A_snippet_package_pk_seq        BEFORE INSERT OR UPDATE of snippet_package_id        ON snippet_package FOR EACH ROWBEGIN        IF (:new.snippet_package_id is null) then          IF INSERTING THEN            SELECT snippet_package_pk_seq.nextval INTO :new.snippet_package_id FROM DUAL;          ELSIF UPDATING THEN            :new.snippet_package_id := :old.snippet_package_id;          END IF;        END IF;END;/CREATE OR REPLACE TRIGGER A_snippet_package_item_pk_seq        BEFORE INSERT OR UPDATE of snippet_package_item_id        ON snippet_package_item FOR EACH ROWBEGIN        IF (:new.snippet_package_item_id is null) then          IF INSERTING THEN            SELECT snippet_package_item_pk_seq.nextval INTO :new.snippet_package_item_id FROM DUAL;          ELSIF UPDATING THEN            :new.snippet_package_item_id := :old.snippet_package_item_id;          END IF;        END IF;END;/CREATE OR REPLACE TRIGGER A_snippet_package_ver_pk_seq        BEFORE INSERT OR UPDATE of snippet_package_version_id        ON snippet_package_version FOR EACH ROWBEGIN        IF (:new.snippet_package_version_id is null) then          IF INSERTING THEN            SELECT snippet_package_ver_pk_seq.nextval INTO :new.snippet_package_version_id FROM DUAL;          ELSIF UPDATING THEN            :new.snippet_package_version_id := :old.snippet_package_version_id;          END IF;        END IF;END;/CREATE OR REPLACE TRIGGER A_snippet_version_pk_seq        BEFORE INSERT OR UPDATE of snippet_version_id        ON snippet_version FOR EACH ROWBEGIN        IF (:new.snippet_version_id is null) then          IF INSERTING THEN            SELECT snippet_version_pk_seq.nextval INTO :new.snippet_version_id FROM DUAL;          ELSIF UPDATING THEN            :new.snippet_version_id := :old.snippet_version_id;          END IF;        END IF;END;///////////////CREATE OR REPLACE TRIGGER A_support_pk_seq        BEFORE INSERT OR UPDATE of support_id        ON support FOR EACH ROWBEGIN        IF (:new.support_id is null) then          IF INSERTING THEN            SELECT support_pk_seq.nextval INTO :new.support_id FROM DUAL;          ELSIF UPDATING THEN            :new.support_id := :old.support_id;          END IF;        END IF;END;/CREATE OR REPLACE TRIGGER A_support_canned_res_pk_seq        BEFORE INSERT OR UPDATE of support_canned_id        ON support_canned_responses FOR EACH ROWBEGIN        IF (:new.support_canned_id is null) then          IF INSERTING THEN            SELECT support_canned_res_pk_seq.nextval INTO :new.support_canned_id FROM DUAL;          ELSIF UPDATING THEN            :new.support_canned_id := :old.support_canned_id;          END IF;        END IF;END;/CREATE OR REPLACE TRIGGER A_support_category_pk_seq        BEFORE INSERT OR UPDATE of support_category_id        ON support_category FOR EACH ROWBEGIN        IF (:new.support_category_id is null) then          IF INSERTING THEN            SELECT support_category_pk_seq.nextval INTO :new.support_category_id FROM DUAL;          ELSIF UPDATING THEN            :new.support_category_id := :old.support_category_id;          END IF;        END IF;END;/CREATE OR REPLACE TRIGGER A_support_history_pk_seq        BEFORE INSERT OR UPDATE of support_history_id        ON support_history FOR EACH ROWBEGIN        IF (:new.support_history_id is null) then          IF INSERTING THEN            SELECT support_history_pk_seq.nextval INTO :new.support_history_id FROM DUAL;          ELSIF UPDATING THEN            :new.support_history_id := :old.support_history_id;          END IF;        END IF;END;/CREATE OR REPLACE TRIGGER A_support_messages_pk_seq        BEFORE INSERT OR UPDATE of support_message_id        ON support_messages FOR EACH ROWBEGIN        IF (:new.support_message_id is null) then          IF INSERTING THEN            SELECT support_messages_pk_seq.nextval INTO :new.support_message_id FROM DUAL;          ELSIF UPDATING THEN            :new.support_message_id := :old.support_message_id;          END IF;        END IF;END;/CREATE OR REPLACE TRIGGER A_support_status_pk_seq        BEFORE INSERT OR UPDATE of support_status_id        ON support_status FOR EACH ROWBEGIN        IF (:new.support_status_id is null) then          IF INSERTING THEN            SELECT support_status_pk_seq.nextval INTO :new.support_status_id FROM DUAL;          ELSIF UPDATING THEN            :new.support_status_id := :old.support_status_id;          END IF;        END IF;END;/CREATE OR REPLACE TRIGGER A_supported_languages_pk_seq        BEFORE INSERT OR UPDATE of language_id        ON supported_languages FOR EACH ROWBEGIN        IF (:new.language_id is null) then          IF INSERTING THEN            SELECT supported_languages_pk_seq.nextval INTO :new.language_id FROM DUAL;          ELSIF UPDATING THEN            :new.language_id := :old.language_id;          END IF;        END IF;END;/CREATE OR REPLACE TRIGGER A_survey_question_types_pk_seq        BEFORE INSERT OR UPDATE of id        ON survey_question_types FOR EACH ROWBEGIN        IF (:new.id is null) then          IF INSERTING THEN            SELECT survey_question_types_pk_seq.nextval INTO :new.id FROM DUAL;          ELSIF UPDATING THEN            :new.id := :old.id;          END IF;        END IF;END;/CREATE OR REPLACE TRIGGER A_survey_questions_pk_seq        BEFORE INSERT OR UPDATE of question_id        ON survey_questions FOR EACH ROWBEGIN        IF (:new.question_id is null) then          IF INSERTING THEN            SELECT survey_questions_pk_seq.nextval INTO :new.question_id FROM DUAL;          ELSIF UPDATING THEN            :new.question_id := :old.question_id;          END IF;        END IF;END;////CREATE OR REPLACE TRIGGER A_surveys_pk_seq        BEFORE INSERT OR UPDATE of survey_id        ON surveys FOR EACH ROWBEGIN        IF (:new.survey_id is null) then          IF INSERTING THEN            SELECT surveys_pk_seq.nextval INTO :new.survey_id FROM DUAL;          ELSIF UPDATING THEN            :new.survey_id := :old.survey_id;          END IF;        END IF;END;//CREATE OR REPLACE TRIGGER A_themes_pk_seq        BEFORE INSERT OR UPDATE of theme_id        ON themes FOR EACH ROWBEGIN        IF (:new.theme_id is null) then          IF INSERTING THEN            SELECT themes_pk_seq.nextval INTO :new.theme_id FROM DUAL;          ELSIF UPDATING THEN            :new.theme_id := :old.theme_id;          END IF;        END IF;END;///CREATE OR REPLACE TRIGGER A_trove_cat_pk_seq        BEFORE INSERT OR UPDATE of trove_cat_id        ON trove_cat FOR EACH ROWBEGIN        IF (:new.trove_cat_id is null) then          IF INSERTING THEN            SELECT trove_cat_pk_seq.nextval INTO :new.trove_cat_id FROM DUAL;          ELSIF UPDATING THEN            :new.trove_cat_id := :old.trove_cat_id;          END IF;        END IF;END;/CREATE OR REPLACE TRIGGER A_trove_group_link_pk_seq        BEFORE INSERT OR UPDATE of trove_group_id        ON trove_group_link FOR EACH ROWBEGIN        IF (:new.trove_group_id is null) then          IF INSERTING THEN            SELECT trove_group_link_pk_seq.nextval INTO :new.trove_group_id FROM DUAL;          ELSIF UPDATING THEN            :new.trove_group_id := :old.trove_group_id;          END IF;        END IF;END;/CREATE OR REPLACE TRIGGER A_trove_treesums_pk_seq        BEFORE INSERT OR UPDATE of trove_treesums_id        ON trove_treesums FOR EACH ROWBEGIN        IF (:new.trove_treesums_id is null) then          IF INSERTING THEN            SELECT trove_treesums_pk_seq.nextval INTO :new.trove_treesums_id FROM DUAL;          ELSIF UPDATING THEN            :new.trove_treesums_id := :old.trove_treesums_id;          END IF;        END IF;END;/CREATE OR REPLACE TRIGGER A_user_bookmarks_pk_seq        BEFORE INSERT OR UPDATE of bookmark_id        ON user_bookmarks FOR EACH ROWBEGIN        IF (:new.bookmark_id is null) then          IF INSERTING THEN            SELECT user_bookmarks_pk_seq.nextval INTO :new.bookmark_id FROM DUAL;          ELSIF UPDATING THEN            :new.bookmark_id := :old.bookmark_id;          END IF;        END IF;END;/CREATE OR REPLACE TRIGGER A_user_diary_pk_seq        BEFORE INSERT OR UPDATE of id        ON user_diary FOR EACH ROWBEGIN        IF (:new.id is null) then          IF INSERTING THEN            SELECT user_diary_pk_seq.nextval INTO :new.id FROM DUAL;          ELSIF UPDATING THEN            :new.id := :old.id;          END IF;        END IF;END;/CREATE OR REPLACE TRIGGER A_user_diary_monitor_pk_seq        BEFORE INSERT OR UPDATE of monitor_id        ON user_diary_monitor FOR EACH ROWBEGIN        IF (:new.monitor_id is null) then          IF INSERTING THEN            SELECT user_diary_monitor_pk_seq.nextval INTO :new.monitor_id FROM DUAL;          ELSIF UPDATING THEN            :new.monitor_id := :old.monitor_id;          END IF;        END IF;END;/CREATE OR REPLACE TRIGGER A_user_group_pk_seq        BEFORE INSERT OR UPDATE of user_group_id        ON user_group FOR EACH ROWBEGIN        IF (:new.user_group_id is null) then          IF INSERTING THEN            SELECT user_group_pk_seq.nextval INTO :new.user_group_id FROM DUAL;          ELSIF UPDATING THEN            :new.user_group_id := :old.user_group_id;          END IF;        END IF;END;/CREATE OR REPLACE TRIGGER A_user_metric_pk_seq        BEFORE INSERT OR UPDATE of ranking        ON user_metric FOR EACH ROWBEGIN        IF (:new.ranking is null) then          IF INSERTING THEN            SELECT user_metric_pk_seq.nextval INTO :new.ranking FROM DUAL;          ELSIF UPDATING THEN            :new.ranking := :old.ranking;          END IF;        END IF;END;/CREATE OR REPLACE TRIGGER A_user_metric0_pk_seq        BEFORE INSERT OR UPDATE of ranking        ON user_metric0 FOR EACH ROWBEGIN        IF (:new.ranking is null) then          IF INSERTING THEN            SELECT user_metric0_pk_seq.nextval INTO :new.ranking FROM DUAL;          ELSIF UPDATING THEN            :new.ranking := :old.ranking;          END IF;        END IF;END;///CREATE OR REPLACE TRIGGER A_users_pk_seq        BEFORE INSERT OR UPDATE of user_id        ON users FOR EACH ROWBEGIN        IF (:new.user_id is null) then          IF INSERTING THEN            SELECT users_pk_seq.nextval INTO :new.user_id FROM DUAL;          ELSIF UPDATING THEN            :new.user_id := :old.user_id;          END IF;        END IF;END;///

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?