ON clause: Pattern matching syntax

Optional clause that specifies a pattern join condition. This form of ON syntax is used in conjunction with a MATCHING clause in a Query statement, database statement, or remote procedure statement.

Syntax

ON {source.column = source.column [= ...] } [AND ...]
Components

source

The name or alias of a data source.

column

The name of a column.

Usage

A query that includes a MATCHING clause pattern definition can also include an optional ON clause that defines a join condition for the pattern. The ON clause consists of one or more multi-equalities. Each multi-equality must refer to one column from every data source listed in the query's FROM clause. The multi-equality condition causes Sybase CEP Engine to search for the specified pattern only among rows where the listed columns of the various data sources contain equal values. All the data sources specified in the ON clause must also be listed as data sources for the query.

A separate pattern search is performed for every unique value contained in the specified columns. This form of the ON clause can be used in a Query statement, Database statement, or Remote Procedure statement.

SEE ALSO

Example

The following example monitors for three consecutive login failures, within three minutes of one another, from the same terminal, and associated with the same user ID:

INSERT INTO OutStream
SELECT L3.TerminalID, L3.UserID
FROM LoginFailure AS L1, LoginFailure AS L2, LoginFailure AS L3
   MATCHING [3 MINUTES: L1, L2, L3]
ON L1.TerminalID = L2.TerminalID = L3.TerminalID
   AND L1.UserID = L2.UserID = L3.UserID;