Write a pl/sql program to input two dates and print number of Sundays between those two dates.
Before each iteration of the loop, condition is evaluated. If it evaluates to TRUE, sequence_of_statements is executed. If condition evaluates to FALSE or NULL, the loop is finished and control resumes after the END LOOP statements.
The only difference between simple loop and while loop is simple execute first and then it will check condition, so simple loop execute at least once and in while loop first it will check condition and then execute.
Input: Enter value for date1: 01-SEP-19 Enter value for date2: 29-SEP-19 Output: no of Sundays : 5
Input: Enter value for date1: 01-SEP-19 Enter value for date2: 15-SEP-19 Output: no of Sundays: 3
Enter value for date1: 01-SEP-19 old 5: Begin D1:='&Date1'; new 5: Begin D1:='01-SEP-19'; Enter value for date2: 29-SEP-19 old 6: D2:='&Date2'; new 6: D2:='29-SEP-19'; no of Sundays:5
PL/SQL procedure successfully completed.
By using while loop first it checks condition and then execute, So We count easily the number of a special day between two dates.
- PLSQL | LOG Function
- PLSQL | MOD Function
- PLSQL | TAN Function
- Difference between SQL and PLSQL
- PLSQL | ABS Function
- PLSQL | CHR Function
- PLSQL | EXP Function
- PLSQL | LN Function
- PLSQL | LEAST Function
- PLSQL | SIN Function
- PLSQL | COS Function
- PLSQL : || Operator
- PLSQL | TRUNC Function
- PLSQL | FLOOR Function
- PLSQL | DECOMPOSE Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.