Skip to main content

CodeMode (Trigger Keyword)

Specifies how this trigger is implemented.


To specify how a trigger is implemented, use the following syntax:

Trigger name [ Event = sqlevent, CodeMode = codemode ]  {    //implementation }

Where codemode is one of the following:

  • code — this trigger is implemented as lines of code (the default).

  • objectgenerator — this trigger is a trigger generator.


There is an older value for this keyword (generator), which is only present for compatibility reasons. Newer applications should use objectgenerator.


This keyword specifies how a given trigger is implemented.

By default, the trigger code consists of one or more lines of code to be executed when the trigger is fired.

If CodeMode is objectgenerator, however, the trigger is actually a trigger generator. A trigger generator is a program invoked by the class compiler that generates the actual implementation for the given trigger. In this case, the trigger code is responsible for the generated code. The logic is similar to that for method generators; see Defining Method and Trigger Generators.


The default value is code. That is, by default, a trigger is not a trigger generator.

See Also

FeedbackOpens in a new tab