Aim:
To print the N number using Loop statement in SQL queries.
Algorithm:
Step 1: Start the program.
Step 2: Declare the variables.
Step 3: Execute the while loop and for loop.
Step 4: Get the output.
Step 5: Stop the process.
Program
WHILE LOOP
DECLAREI number;
BEGIN
I:=1;
While(I<=10)
loop
dbms_output.put_line(I);
I:=I+1;
END loop;
END;
OUTPUT:
12
3
4
5
6
7
8
9
10
FOR LOOP
Begin
For I in 1..10
loop
dbms_output.put_line(I);
End loop;
End;
OUTPUT:
1
2
3
4
5
6
7
8
9
10
Post a Comment