I made a bash script that connects to a database by SQLPlus and runs a SQL Script which contains a For loop as below. But once running it, it stuck in the BEGIN of the loop as below. I tried to run it directly through SQLPlus and it is the same. So can anyone advise what is done wrong here.
BEGIN
FOR l_counter IN 1..5
LOOP
DBMS_OUTPUT.PUT_LINE( l_counter );
END LOOP;
END
Result:
BEGIN
2 FOR l_counter IN 1..5
3 LOOP
4 DBMS_OUTPUT.PUT_LINE( l_counter );
5 END LOOP;
6 END;
7
8
Bash:
SPOOL $FILE
@/home/genesys/scripts/Counter.sql
SPOOL OFF
EXIT
EOF
Edit: This is the result I am getting after adding a slash at the end.
SQL> set serveroutput on;
SQL> BEGIN
FOR l_counter IN 1..10
LOOP
DBMS_OUTPUT.PUT_LINE( l_counter || ' finished ');
END LOOP;
END;/ 2 3 4 5 6
7
8
9
10