Difference between revisions of "CREATE TRIGGER"
From Recital Documentation Wiki
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
==Class== | ==Class== | ||
SQL Applications | SQL Applications | ||
Line 58: | Line 55: | ||
<code lang="recital"> | <code lang="recital"> | ||
USE accounts | USE accounts | ||
− | CREATE TRIGGER ON customer FOR UPDATE AS | + | CREATE TRIGGER ON customer FOR UPDATE AS not empty(CustName) |
</code> | </code> | ||
Revision as of 10:47, 28 April 2009
Class
SQL Applications
Purpose
Creates a trigger for a table
Syntax
CREATE TRIGGER ON [<database>!]<table>
FOR UPDATE | INSERT | DELETE
AS <expression>
See Also
ADD TABLE, ALTER INDEX, ALTER TABLE, DROP TABLE, INSERT, SELECT, CONSTRAINTS, DATA TYPES, DB_DATADIR, GETENV(), SET AUTOCATALOG, SET TCACHE, SET XMLFORMAT,
Description
The CREATE TRIGGER command is used to create a trigger for the specified table. Triggers cause the logical <expression> to be evaluated when certain operations are attempted.
Trigger | Operation |
---|---|
UPDATE | Attempt to modify an existing record |
INSERT | Attempt to add a new record |
DELETE | Attempt to delete an existing record |
If the <expression> evaluates to False (.F.) the operation does not complete. If the <expression> evaluates to True (.T.) the operations does complete.
Keywords | Description |
---|---|
database | The name of the database to which the table belongs. Databases in Recital are implemented as directories containing files that correspond to the tables and associated files in the database. Operating System file protection can be applied individually to the files for added security. The directory is a sub-directory of the Recital data directory. The environment variable / symbol DB_DATADIR points to the current Recital data directory and can be queried using the GETENV() function. Files from other directories can be added to the database using the ADD TABLE command or via the database catalog and SET AUTOCATALOG functionality. The '!' character must be included between the database name and the table name. |
table | The name of the table |
INSERT | DELETE | Specifies the type of trigger to be created. |
expression | A logical expression to be evaluated |
Example
USE accounts CREATE TRIGGER ON customer FOR UPDATE AS not empty(CustName)
Products
Recital Database Server, Recital Mirage Server, Recital Terminal Developer