Table Triggers

The Triggers page is used to set a list of table triggers.

A trigger is a function consisting of SQL commands and describing the operations to be executed under certain conditions.

To create a trigger, click the Add button. A line is added to the end of the list, in which specify the following attributes:

    • INSERT. Adding data to the table.

    • DELETE. Deleting data from the table.

    • UPDATE. Modifying data in the table.

NOTE. The attribute is used only when script text is specified in the Script box for Oracle, Teradata, PostgresSQL drivers.

To edit the selected trigger, change value in the corresponding column.

To change the number of displayed attributes, click the Settings button and select or deselect the checkbox next to attribute name.

To delete one or several triggers, select them and click the Delete button. A confirmation dialog box opens.

To finish the wizard, click the Save button.

Script text

To specify trigger script text, click the Script button in the field of the Text attribute.

After executing the operation the Script dialog box opens:

In the Script Text field specify trigger code in the SQL language. The code is entered according to the SQL syntax, which is set for the selected DBMS driver. For example, code should be specified between the keywords for Microsoft SQL Server based servers:

AS
BEGIN
...
END;

Code should be specified between the keywords for Oracle based servers:

BEGIN
...
END;

The selected DBMS driver and the driver list are displayed next to the Script Text field. By default, the driver list displays the selected driver used during repository connection setup. If script text is specified for one or several drivers, the selected driver(s) will be marked in the driver list.

To show or hide the driver list, use the Hide Driver List/Show Driver List button.

To set the specified script text for all DBMS, click the Apply for All DBMS button. The confirmation dialog box opens. If script text is specified for at least one driver that is different from the current one, all the specified scripts will be replaced with the current one if the answer is positive.

To apply trigger script texts to the selected DBMS drivers, click the Apply button.

To create a trigger:

The Trigger Properties dialog box opens.

To edit selected trigger:

The Trigger Properties dialog box opens. Enter required changes to it. The Trigger Properties dialog box also opens on double-click.

To delete the current trigger, click the Delete button or press CTRL+DELETE.

If a trigger is created outside Foresight Analytics Platform (for example, in TOAD), it can be refreshed. To do this, click the Refresh button.

Trigger Properties

The Trigger Properties dialog box opens when a trigger is created or edited:

Determine the following attributes in the opened dialog box:

    • INSERT. Adding data to the table.

    • DELETE. Deleting data from the table.

    • UPDATE. Modifying data in the table.

NOTE. If a Microsoft SQL Server driver is chosen, the AFTER/BEFORE checkbox does not affect the created trigger, because Microsoft SQL Server does not have such division.

AS
BEGIN
...
END;

The entire code must be specified between keywords for Oracle-based servers:

BEGIN
...
END;

See also:

Table