|
|
IF
Provides conditional execution based on the truth value of a conditional expression.
Usage
Description
The
IFstatement allows a sequence ofprocedural-sql-statementsto be conditionally executed depending on the truth value of asearch-condition.For a list of
procedural-sql-statements, see Procedural SQL Statements.All of the predicates supported by Mimer SQL may be used in the
search-condition, see Predicates.The
search-conditionis always evaluated directly in the context of theIFstatement, its value cannot be pre-assigned to a data item which is used in its place.In a basic
IFstatement, the sequence ofprocedural-sql-statementsin theTHENclause will be executed ifsearch-conditionevaluates to true, otherwise the sequence ofprocedural-sql-statementsin theELSEclause will be executed.One or more
IFstatements can be nested by using theELSEIFclause in place of anELSEclause containing anotherIFstatement.Language Elements
search-condition, see Search Conditions.Notes
If the
search-conditionequalsNULLor directly includes theNULLvalue, it evaluates to unknown and it treated as false. If it is required that the conditional expression test for theNULLvalue, then the correct behavior is achieved by using theIS NULLpredicate, see The NULL Predicate.Example
IF X > 50 THEN SET X = 50; SET Y = 1; ELSE SET Y = 0; END IF; IF bookTitle = ('0-201-43328-1','JDBC API Tutorial and Reference') THEN ... END IF;For more information, see the Mimer SQL Programmer's Manual, Conditional Execution Using IF.
Standard Compliance
|
Mimer Information Technology AB Voice: +46 18 780 92 00 Fax: +46 18 780 92 40 info@mimer.se |
|
|