PL/SQL, or Procedural Language for SQL, is the procedural language for the Oracle Database management system. It includes various control structures such as IF, FOR, and WHILE loops that can be used to control the flow of execution in a PL/SQL program.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-PqJxmWeGfTD8SiromfDPnyz1C-YS8E39mUPhHJYNVTsn-wAjiOkffyuDNlj8EjCC_J1ViSq10xytBNAS1WQs_jzT6pb1CdO5j6e5y1ZnlBKRcNB5A6TK8AFDjOTAFKx8yGQ_z3CN0x9yyqv88LTh32zR5D-r8SfTvVVALpGIdPR1YV5cQMTHx7DK/w640-h288/programmingdoor.com_plsql12.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-PqJxmWeGfTD8SiromfDPnyz1C-YS8E39mUPhHJYNVTsn-wAjiOkffyuDNlj8EjCC_J1ViSq10xytBNAS1WQs_jzT6pb1CdO5j6e5y1ZnlBKRcNB5A6TK8AFDjOTAFKx8yGQ_z3CN0x9yyqv88LTh32zR5D-r8SfTvVVALpGIdPR1YV5cQMTHx7DK/w640-h288/programmingdoor.com_plsql12.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi648vb9CKzwGB31UioTX_6a6eRiKUnpA_wteE9eiGFDY44Ej2Cu7lAX0sIYHMLh4EKBHjyuXgDaZK7YV0lJvz7IDqPwHvHQa01gXOcKE4lM9BCGu9wKIUJ0qC_fNc758P2TOwXk1co_B7KFa3s17vqoLx4SZpyZOUwWXVOE_XplcXDEcpHL5GmfovP/w640-h354/programmingdoor.com_plsql13.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi648vb9CKzwGB31UioTX_6a6eRiKUnpA_wteE9eiGFDY44Ej2Cu7lAX0sIYHMLh4EKBHjyuXgDaZK7YV0lJvz7IDqPwHvHQa01gXOcKE4lM9BCGu9wKIUJ0qC_fNc758P2TOwXk1co_B7KFa3s17vqoLx4SZpyZOUwWXVOE_XplcXDEcpHL5GmfovP/w640-h354/programmingdoor.com_plsql13.png)
IF statement: The IF statement is used to execute a specific block of code if a certain condition is true. The basic syntax of an IF statement is as follows:Example:
In this example, the condition “x > 5” is true, so the output will be “x is greater than 5”.
FOR loop: The FOR loop is used to execute a specific block of code a certain number of times. The basic syntax of a FOR loop is as follows:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhnSJmdodUcNfDopUeY79XDACof4pwSjfbVMgd_91z9IYrEzJEG3YRfZVIa3KDQJS1yaHuZW72vdg9CI7bDtdxzx7SyP5lrrKLBNuqWBcEiwqmNvhonGsWbU72_NkQ2qsO94rnroYWqENAzVCVYC-CqqQXtV51HNRUcDDSLXAhSKdxlf6h4o4w9Kyg/w640-h302/programmingdoor.com_plsql14.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhnSJmdodUcNfDopUeY79XDACof4pwSjfbVMgd_91z9IYrEzJEG3YRfZVIa3KDQJS1yaHuZW72vdg9CI7bDtdxzx7SyP5lrrKLBNuqWBcEiwqmNvhonGsWbU72_NkQ2qsO94rnroYWqENAzVCVYC-CqqQXtV51HNRUcDDSLXAhSKdxlf6h4o4w9Kyg/w640-h302/programmingdoor.com_plsql14.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6PGGU-7mLDY-5muoEnbnxQlHEqWE6EZ1sYww1BFyr3qLNLnMd4TEBGSE7symXMN2YD8QUSzmHKDnv6mogKoIQOJT7jEBo9q6IIJv8o4dP_3xGWO1-KLqN-2ERAGT5p7HbuTINRJGIx3uDiMQeQQ2TojLt9pWYZDCgyCO9pUUpFF4tXube4EjVl6vn/w640-h502/programmingdoor.com_plsql15.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6PGGU-7mLDY-5muoEnbnxQlHEqWE6EZ1sYww1BFyr3qLNLnMd4TEBGSE7symXMN2YD8QUSzmHKDnv6mogKoIQOJT7jEBo9q6IIJv8o4dP_3xGWO1-KLqN-2ERAGT5p7HbuTINRJGIx3uDiMQeQQ2TojLt9pWYZDCgyCO9pUUpFF4tXube4EjVl6vn/w640-h502/programmingdoor.com_plsql15.png)
In this example, the loop will iterate 5 times, and the value of x will be printed in each iteration. The output will be 1, 2, 3, 4, 5.
WHILE loop: The WHILE loop is used to execute a specific block of code repeatedly as long as a certain condition is true. The basic syntax of a WHILE loop is as follows:
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeRhQjHUXNohi6YBpl8n4GYv0rGg0E1C_j0uWtil1mCQcTOhaIcWPWvalhS1yxt1YcItbSALZ-3EtluGzM3OOpGPb5z5S-_jimL64UcRyNteAACKYPWd5GVDaXi3u1F0m0_dYiRhxdo4_UUXhZ5f03g-bIDmTQoshIBcKrUfTM8K1FDRwFgEaxlbRs/w640-h302/programmingdoor.com_plsql16.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeRhQjHUXNohi6YBpl8n4GYv0rGg0E1C_j0uWtil1mCQcTOhaIcWPWvalhS1yxt1YcItbSALZ-3EtluGzM3OOpGPb5z5S-_jimL64UcRyNteAACKYPWd5GVDaXi3u1F0m0_dYiRhxdo4_UUXhZ5f03g-bIDmTQoshIBcKrUfTM8K1FDRwFgEaxlbRs/w640-h302/programmingdoor.com_plsql16.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvO3ziPb0e4puON2uIqAigaAyLTMWtlNg7PmcROE4jvVD8ZI9QXCBBTtZD2a9dbTZBZvFtYmL1TXkSP5yzMtr6xgR0pW8umZ0AKncpAtRz80gCxdKpeCWyMKCk4V34z4WLkvSVMdqnNQfWDO4VaySDuGM64EtfYu8sVUhbmmr_NGo26Tjsy-ClSgRw/w640-h532/programmingdoor.com_plsql17.png)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvO3ziPb0e4puON2uIqAigaAyLTMWtlNg7PmcROE4jvVD8ZI9QXCBBTtZD2a9dbTZBZvFtYmL1TXkSP5yzMtr6xgR0pW8umZ0AKncpAtRz80gCxdKpeCWyMKCk4V34z4WLkvSVMdqnNQfWDO4VaySDuGM64EtfYu8sVUhbmmr_NGo26Tjsy-ClSgRw/w640-h532/programmingdoor.com_plsql17.png)
Example:
In this example, the loop will iterate 5 times, and the value of x will be printed in each iteration. The output will be 1, 2, 3, 4, 5.
These control structures can be combined and nested to create more complex programs.