In this example, we have checked the value of the variable, and when the value is equal or greater than 7, the code entered the IF…ELSE block and executed the BREAK statement, and so it exited the loop immediately. The syntax of the WHILE loop in SQL looks like as follows: If any SQL statement exists outside the loop, it will be executed. Otherwise, the code flow will exit the loop. If the result of the condition is true, the SQL statement will be executed. The following flowchart explains the essential structure of the WHILE loop in SQL:Īs you can see, in each iteration of the loop, the defined condition is checked, and then, according to the result of the condition, the code flow is determined. In the flowchart, each geometric symbol specifies different meanings. The flowchart is used to simply design and document the algorithms. The flowchart is a visual geometric symbol that helps to explain algorithms visually. For this reason, firstly, we will explain what is a flowchart briefly. In the following sections of this article, we will use more flowcharts in order to explain the notions and examples. SQL WHILE loop provides us with the advantage to execute the SQL statement(s) repeatedly until the specified condition result turn out to be false.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |