Procedures are named, complex expression. The rules for specifying them are:
-
The first statement in a procedure must be a “procedure” statement. This contains the name of the procedure, a list of input arguments (a void or empty argument list is allowed), and a “returns” clause, which indicates the type of the return value.
-
Column references are not allowed within the body of the procedure. The current row is not an implied input; you must explicitly define the input parameters that are required.
The following programming statements are allowed:
-
Variable declaration (“declare type variable name;”)
-
Assignment
-
“if / else”
-
“switch / case / default”
-
“while”
-
“do”
-
“for”
-
“break” and “continue”
-
“return”
-
blocks, where multiple statements can be grouped within left and right braces. Anywhere a single statement can be used, a block of statements can be specified.
-
Statements must be terminated with a semi-colon (;).
-
The last statement must be an “end;” statement