Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TRIGGER is broken “when if end if" is using #156

Open
tempbrucefu opened this issue Sep 7, 2023 · 0 comments
Open

TRIGGER is broken “when if end if" is using #156

tempbrucefu opened this issue Sep 7, 2023 · 0 comments

Comments

@tempbrucefu
Copy link

Hello,

When running following statement as a single changeset,
CREATE TRIGGER TRG_DO_DELETE BEFORE
DELETE ON TABLE_TEST REFERENCING OLD ROW OLDROW
FOR EACH ROW
BEGIN
IF :OLDROW.IS_DEFAULT = TRUE THEN
DECLARE DELTABLE_TEST_ERROR CONDITION FOR SQL_ERROR_CODE 10002;
DECLARE EXIT HANDLER FOR DELTABLE_TEST_ERROR RESIGNAL;
SIGNAL DELTABLE_TEST_ERROR SET MESSAGE_TEXT = 'Cannot delete default';
END IF;
END;

the syntax error will be reported and the script is parsed as "CREATE TRIGGER TRG_DO_DELETE BEFORE
DELETE ON TABLE_TEST REFERENCING OLD ROW OLDROW
FOR EACH ROW
BEGIN
IF :OLDROW.IS_DEFAULT = TRUE THEN
DECLARE DELTABLE_TEST_ERROR CONDITION FOR SQL_ERROR_CODE 10002;
DECLARE EXIT HANDLER FOR DELTABLE_TEST_ERROR RESIGNAL;
SIGNAL DELTABLE_TEST_ERROR SET MESSAGE_TEXT = 'Cannot delete default';
END"

BTW, when more trigger creations are put into a single changeset, it will be not split into two stataments and syntax error will be reported which is similar to run when scripts including multiple trigger creations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant