[This topic is migrated from our old forums. The original author name has been removed]
We know we can change things like statement deimiters through the preferences dialog but on some occasions it would be useful to have a command that essentially says "in this block, use the following preferences".
What's prompted this is that I'm just working up a unit test script for the addition of a DB2 trigger. The trigger needs to run 2 sql statements in response to an update. As it needs to run 2 statements the drop and create statements have to look like the example below (where @ is the new delimiter).
DROP TRIGGER MYSCHEMA.MYTRIGGER@ CREATE TRIGGER MYSCHEMA.MYTRIGGER AFTER UPDATE OF SOME_FIELD ON MYSCHEMA.MYTABLE REFERENCING NEW ROW AS NEW FOR EACH ROW MODE DB2SQL WHEN (new.SOME_FIELD = 'D') BEGIN ATOMIC
the first sql statement goes here;
the second sql statement goes here;
END @
Ideally, my unit test script will have a bunch of statements to set up test data, run in the trigger and then a bunch of statements to trigger it and verify the results.
I don't want to write the whole script using the @ statement delimiter as it isn't highlighted as with semi-colon and would be non-standard and liable to confuse.
If I could surround a statement with a command that says "use this delimiter", I could drop in those non-standard sql statements and then return to the rest of the script using our standard expected delimiters.
I'm sure there are other settings that would be useful to set within a script through the use of commands but this is the one that's making me revisit the properties panel a lot today.
[This reply is migrated from our old forums. The original author name has been removed]
Re: New Inline editor commands
Yes, that kind of thing would be ideal.
I'm sure there are other "preferences" that users would like to see made available the same way. As I come across settings I'd use I'll post back here.
anonymous
We know we can change things like statement deimiters through the preferences dialog but on some occasions it would be useful to have a command that essentially says "in this block, use the following preferences".
What's prompted this is that I'm just working up a unit test script for the addition of a DB2 trigger. The trigger needs to run 2 sql statements in response to an update. As it needs to run 2 statements the drop and create statements have to look like the example below (where @ is the new delimiter).
DROP TRIGGER MYSCHEMA.MYTRIGGER@
CREATE TRIGGER MYSCHEMA.MYTRIGGER
AFTER UPDATE OF SOME_FIELD ON MYSCHEMA.MYTABLE
REFERENCING NEW ROW AS NEW
FOR EACH ROW
MODE DB2SQL
WHEN (new.SOME_FIELD = 'D')
BEGIN ATOMIC
the first sql statement goes here;
the second sql statement goes here;
END
@
Ideally, my unit test script will have a bunch of statements to set up test data, run in the trigger and then a bunch of statements to trigger it and verify the results.
I don't want to write the whole script using the @ statement delimiter as it isn't highlighted as with semi-colon and would be non-standard and liable to confuse.
If I could surround a statement with a command that says "use this delimiter", I could drop in those non-standard sql statements and then return to the rest of the script using our standard expected delimiters.
I'm sure there are other settings that would be useful to set within a script through the use of commands but this is the one that's making me revisit the properties panel a lot today.