Both the WHEN clause and the trigger actions may access elements of the row being inserted, deleted or updated using references of the form "NEW.column-name" and "OLD.column-name", where column-name is the name of a column from the table that the trigger is associated with.
OLD and NEW references may only be used in triggers on events for which they are relevant, as follows: If a WHEN clause is supplied, the SQL statements specified are only executed if the WHEN clause is true.
In other words, the old row and the new row are simply destroyed and you're left with the same thing you started with: the actual row.
The Trigger action defines the SQL statements you want the Trigger to execute when it is activated and has three parts: the action granularity, the action when condition and the action body.
A variety of SQL statements are legal inside the Trigger body, though.
Permission is granted to distribute this document without any alteration under the terms of the HSQLDB license.
clause define the timing point for the trigger, which is explained below.
If you are on a personal connection, like at home, you can run an anti-virus scan on your device to make sure it is not infected with malware.
If you are at an office or shared network, you can ask the network administrator to run a scan across the network looking for misconfigured or infected devices.
CREATE OR REPLACE TRIGGER my_test_trg BEFORE INSERT OR UPDATE OR DELETE ON my_table FOR EACH ROW BEGIN -- Flags are booleans and can be used in any branching construct. If you need some code to perform an operation that needs to commit, regardless of the current transaction, you should put it in a stored procedure defined as an autonomous transaction, shown here.
CASE WHEN INSERTING THEN -- Include any code specific for when the trigger is fired from an INSERT. WHEN UPDATING THEN -- Include any code specific for when the trigger is fired from an UPDATE. WHEN DELETING THEN -- Include any code specific for when the trigger is fired from a DELETE. DML triggers have four basic timing points for a single table. With the exception of Compound Triggers, the triggers for the individual timing points are self contained and can't automatically share state or variable information.