Triggers Node

This section covers the following topics:

About Triggers

A trigger is a stored database procedure that is automatically invoked whenever a table or view is modified, for example by INSERT, UPDATE, or DELETE operations. In PL/SQL, triggers can either of the following:

  • A stored PL/SQL block associated with a table, a schema, or the database or

  • An anonymous PL/SQL block or a call to a procedure implemented in PL/SQL or Java

Oracle Database automatically executes a trigger when specified conditions occur.

How the Triggers Node Works

There are two types of Triggers Nodes: One is a child of Data Connection Node and contains a set of all triggers in the database that are visible to the user. The other is a child of a Table Node and contains only those triggers that apply to the particular table. The Triggers Node that is a child of Data Connection Node contains the Table Triggers Node, View Triggers Node, Schema Triggers Node, and Database Triggers Node category nodes. Each of these nodes can contain one or more child Trigger Nodes.

To perform actions on the Triggers node: right-click this node and from the menu choose the appropriate command. To view the node's properties, select the node and/or click Properties in the node's menu.

If this collection node is filtered, the icon changes to include a funnel symbol. For more information about filtering, see Filtering Collection Nodes.

See Also

Data Connection Node | Table Node

Menu Options (child of Data Connection Node)

Menu Option Description

Add Trigger

Creates a new trigger with the Trigger Designer.

This command is not supported for object tables or object views.

Query Window

Opens the Query Window so that you can execute SQL and PL/SQL queries from Visual Studio.

Generate Create Script

Writes the trigger definitions to a .sql file.

If the object associated with the triggers node is deleted from the database backend, this menu option does the following:

Displays a message indicating that this object no longer exists in Oracle Database, and the script will not be generated.

Generate Create Script to Project

Generates the trigger definitions to a .sql file and adds the .sql file to an open Oracle Database Project.

If multiple objects in Server Explorer are selected, a master SQL script is created in the Oracle Database Project Scripts folder. This master script contains calls to individual child SQL scripts (one for each schema object) generated into the various schema object folders and this master script is ordered with dependencies taken into consideration.

If there are multiple open Oracle Database projects, Visual Studio prompts you to select the project to add the script to.

This operation can also be performed by dragging and dropping the Server Explorer node(s) directly onto a database project folder.

See Managing Oracle Script Files for more information.

Note: Oracle Database Project Version 2 projects are not supported. To add scripts to this project type, use Import Schema or Add Existing Item menu items on an Oracle Database Project Version 2 project folder, or use the Schema Compare tool.

Filters

Opens the Filters Tab to control which child nodes appear under the collection.

Refresh

Updates the Triggers node tree, including its associated trigger nodes.

Properties

Displays the Properties window.

Menu Options (child of Table Node)

Menu Option Description

Add Trigger

Creates a new trigger with the Trigger Designer.

This command is not supported for object tables or object views.

Compile

Compiles all triggers.

Compile Debug

Compiles all triggers with debug information.

This is required before PL/SQL code can be debugged. See Compiling a PL/SQL Program with Debug Information.

Copy

Copies all triggers.

Refresh

Updates the Triggers node.

Properties

Displays the Properties window.