#sqlCondition directive
The #sqlCondition directive lists conditions for an SQL SELECT statement.
The directive behaves like an SQL WHERE clause without the WHERE. The #sqlCondition directive is used only with the defaultSelectCondition property of the SQL Record part (see SQLRecord stereotype).
Syntax
#sqlCondition{
condition
}
- condition
- Whatever you specify here goes into an SQL WHERE clause (do not include the "WHERE" itself). Therefore it must follow the rules from your SQL provider for search conditions. The conditions can be simple or complex; see the examples in this topic.
Examples
The following example shows the directive as part of a record definition:
Record CustomerRecord type sqlRecord
{ tableNames = [["Customer"]],
keyItems = ["customerNumber"],
defaultSelectCondition =
#sqlCondition{
customer_balance > 0
}
}This example shows a more complex condition:
#sqlCondition{
customer_balance >= :minimumBalance
AND
customer_number IN (SELECT customer_number FROM Orders)
}An initial colon character indicates the use of a host variable
(a variable defined in the language hosting SQL, in this case, EGL),
for example, :minimumBalance.