PostgreSQL provides the for loop statements it execute until condition is not false it is check print value one by one in loop .
do
$$
declare r1 int ;r2 int:=2;
begin
for r1 in 1..10 loop
raise notice '%',r1* r2;
end loop;
end
$$
declare r1 int ;r2 int:=2;
begin
for r1 in 1..10 loop
raise notice '%',r1* r2;
end loop;
end
$$
Code :2
do
$$
declare r1 int ;
begin
for r1 in reverse 10..1 loop
raise notice '%',r1;
end loop;
end
$$
Task : Fetch data only which employee id is Odd
WHILE LOOP
No comments:
Post a Comment