Sequential control statements in pl/sql
- control statements in sql
- control statements in sql programming language
- control statements in sql server
- conditional statements in sql
Describe any three conditional statements in pl/sql!
Loop control statements in pl/sql
SQL SERVER | Conditional Statements
While loop: In SQL SERVER, while loop can be used in similar manner as any other programming language. A while loop will check the condition first and then execute the block of SQL Statements within it as long as the condition evaluates true.
Syntax:
WHILE condition BEGIN {...statements...} END;Parameters:
1.
Condition: The condition is tested in each pass through the loop. If condition evaluates to TRUE, the loop body is executed otherwise the loop is terminated.
2. Statements: The statements that needs to be executed in each pass through the loop.
Example:
Output:
Break statement: BREAK statement as the name signifies is used to break the flow of control.
It can be used in SQL in similar manner as any other programming language.
Example: While loop with Break statement
Output:
Note : In the example, when variables value became five, BREAK Statement is executed and the control gets out from the Loop.
Do-While loop:
- control structure in sql
- conditional statements in sql server