DB version : 11.2
In bash , I can execute a for loop to loop through hard coded values a,b and c like below.
How can I do the same in PL/SQL ?
$ cat test.sh
#!/bin/bash
for i in a b c
do
echo $i
done
$
$ ./test.sh
a
b
c
$
I tried the following PL/SQL block. But, it didn't work. Any way how I can write the equivalent of the above shell script in PL/SQL ?
begin
for i in a b c
loop
dbms_output.put_line(i);
end loop;
end;
/
Log :
SQL> begin
for i in a b c
loop
dbms_output.put_line(i);
end loop;
end; 2 3 4 5 6
7 /
for i in a b c
*
ERROR at line 2:
ORA-06550: line 2, column 12:
PLS-00103: Encountered the symbol "B" when expecting one of the following:
. ( * @ % & - + / at loop mod remainder rem ..
<an exponent (**)> || multiset