Sybase Formatting Control Structures Standard
Filed in Sybase on May.14, 2009
Control Structures
IF <expression> THEN
Executable_statements
ELSE
Executable_Statements
If executable statements are more than one statement then use BEGIN … END block for grouping the statements.
Recommendation:
- One line space after executable statements
- Executable statements should be indented atleast by 3 spaces.
- If the executable statements inside an IF statement clause themselves contain another IF statement, then IF- ELSE and keywords should be indented inside the enclosing IF statements for the inner IF should be indented further so that they are clearly with in the nested IF.
Formatting Loops
Transact-SQL offers the WHILE loop. The GOTO statement can also be used for looping purposes.
Syntax:
WHILE Boolean_expression
{sql_statement | statement_block}
[BREAK] [CONTINUE]
Eg:
WHILE condition
Executable_Statements
END
BREAK / CONTINUE can be used within the loop to encounter the exceptions.
Each loop has a loop boundary and a loop body. The loop body should be indented from the boundary.


Leave a Reply