Sybase CEP Function Language creates CCL user-defined functions which are used interchangeable with predefined functions.
Use the Sybase CEP Function Language (CFL) to create CCL user-defined functions (UDFs), which can be used interchangeably with predefined functions. Use the Create Function statement to create a CCL UDF. The CCL Function Language consists of simple statements and block statements.
Simple statements include:
Create Variable statement: Declares a variable name and data type and optionally assigns a value to the variable.
Assignment statement: Assigns a value to a variable created with the Create Variable statement.
Return statement: Indicates the end of function execution.
Break statement: Exits a WHILE loop (used only inside a While statement).
Continue statement: Interrupts the execution of a WHILE loop and forces a re-evaluation of the WHILE condition (used only inside a While statement).
The following rules apply to all simple CFL statements:
Simple statements always appear inside the Create Function statement, either directly or as part of an enclosing block statement.
Except where otherwise specified, expressions used in the simple statements can include any of the following:
CCL operators.
Function parameters declared in the Create Function statement.
Variables defined with a CFL Create Variable statement, whose scope makes them visible to the referring statement.
Predefined Sybase CEP scalar functions (aggregate and miscellaneous predefined functions cannot be used in CCL UDF definitions).
Other CCL UDFs.
Block statements include:
If statement: Provides alternative execution based on one or more conditional expressions.
Case statement: Provides alternative execution based on one or more conditional expressions.
While statement: Provides repetitive execution (a loop) based on a simple conditional expression.
The following rules apply to all block CFL statements:
Block statements always appear inside the Create Function statement, either directly or nested in other block statements.
The conditions specified within block statements are Boolean expressions. These Boolean expressions are subject to the same restrictions as expressions within simple CFL statements.