The IF-THEN statement controls logic execution flow in a compound statement, that is, it allows you to specify what logic to use, based on some condition that you specify.
Following is the syntax for the IF-THEN statement:
►►─ IF ─ proc-search-condition ─ THEN ─ proc-SQL-stmt-list ───────────────────► ►─┬──────────────────────────────────────────────────────────────┬───────────► └─ ELSEIF ─ proc-search-condition ─ THEN ─ proc-SQL-stmt-list ─┘ ►─┬─────────────────────────────┬─ END IF ───────────────────────────────────►◄ └─ ELSE ─ proc-SQL-stmt-list ─┘
The proc-search-condition specifies a condition that is true, false, or unknown about a row. The proc-search-condition is similar to the search-condition described in with the following modifications that allow its use in SQL Procedures:
A proc-SQL-stmt-list is a list of proc-SQL-stmt statements, each terminated by a semicolon. For information about a proc-SQL-stmt, see CREATE PROCEDURE Syntax and Description.
|
Copyright © 2014 CA.
All rights reserved.
|
|