You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin, SBT plugin, ANT tasks)
Command-Line
What database are you using (type & version)?
DB2 9.7
What operating system are you using?
Windows
What did you do?
(Please include the content causing the issue, any relevant configuration settings, and the command you ran)
Trying to setup a trigger in DB2 fails depending on the statements formatting.
If BEGIN is found at the beginning of any row in the statement the import fails.
What's that special with BEGIN??
(Think the problem is not restricted to DB2 merley)
--#SET TERMINATOR /
CREATE OR REPLACE TRIGGER I_TRIGGER_I
BEFORE INSERT ON I_TRIGGER
REFERENCING NEW AS NEW FOR EACH ROW BEGIN ATOMIC
IF NEW.ID IS NULL
THEN SET NEW.ID = NEXTVAL FOR SEQ_I_TRIGGER;
END IF;
END
/
-- Note and workaround
if statement is re-formatted as below it works (but took me an hour to elaborate)
CREATE OR REPLACE TRIGGER I_TRIGGER_I
BEFORE INSERT ON I_TRIGGER
REFERENCING NEW AS NEW FOR EACH ROW BEGIN ATOMIC
IF NEW.ID IS NULL
THEN SET NEW.ID = NEXTVAL FOR SEQ_I_TRIGGER;
END IF;
END
/
What did you expect to see?
success
What did you see instead?
SQL State : 42601
Error Code : -104
Message : BEGIN ATOMIC
IF ;S NEW FOR EACH ROW
;<psm_begin_function_compou
The text was updated successfully, but these errors were encountered:
What version of Flyway are you using?
4.2.0
Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin, SBT plugin, ANT tasks)
Command-Line
What database are you using (type & version)?
DB2 9.7
What operating system are you using?
Windows
What did you do?
(Please include the content causing the issue, any relevant configuration settings, and the command you ran)
Trying to setup a trigger in DB2 fails depending on the statements formatting.
If BEGIN is found at the beginning of any row in the statement the import fails.
What's that special with BEGIN??
(Think the problem is not restricted to DB2 merley)
--#SET TERMINATOR /
CREATE OR REPLACE TRIGGER I_TRIGGER_I
BEFORE INSERT ON I_TRIGGER
REFERENCING NEW AS NEW FOR EACH ROW
BEGIN ATOMIC
IF NEW.ID IS NULL
THEN SET NEW.ID = NEXTVAL FOR SEQ_I_TRIGGER;
END IF;
END
/
-- Note and workaround
if statement is re-formatted as below it works (but took me an hour to elaborate)
CREATE OR REPLACE TRIGGER I_TRIGGER_I
BEFORE INSERT ON I_TRIGGER
REFERENCING NEW AS NEW FOR EACH ROW BEGIN ATOMIC
IF NEW.ID IS NULL
THEN SET NEW.ID = NEXTVAL FOR SEQ_I_TRIGGER;
END IF;
END
/
What did you expect to see?
success
What did you see instead?
SQL State : 42601
Error Code : -104
Message : BEGIN ATOMIC
IF ;S NEW FOR EACH ROW
;<psm_begin_function_compou
The text was updated successfully, but these errors were encountered: