I am trying to use the following code:
SET SERVEROUTPUT ON VERIFY OFF
ACCEPT i_name PROMPT 'Enter your name: '
DECLARE
v_name VARCHAR2(30) := '&i_name';
BEGIN
dbms_output.put_line('This is right before the PAUSE.');
PAUSE 'Adjust paper and press RETURN to continue.';
dbms_output.put_line('Your name is: ' || v_name);
END;
/
But I am receiving these errors:
ORA-06550: line 5, column 8:
PLS-00103: Encountered the symbol "Adjust paper and press RETURN to continue."
when expecting one of the following:
:= . ( @ % ;
The symbol ":=" was substituted for "Adjust paper and press RETURN to
continue." to continue.
Am I allowed to use the PAUSE statement within the PL/SQL block, or does it have to be before the DECLARE statement?
If I am allowed to use it within the block, then why am I receiving an error? I tried both with and without the semicolon at the end of the PAUSE statement.
On this site: http://download.oracle.com/docs/cd/A87860_01/doc/server.817/a82950/ch8.htm#1001319 it has the following example:
SET PAUSE OFF
PAUSE Adjust paper and press RETURN to continue.
SELECT ...
But why would you turn the pause OFF? And then when do you turn it ON? Also, that example seems to conflict with the advice listed here: http://download.oracle.com/docs/cd/B19306_01/server.102/b14357/ch12040.htm#i2699261
Which says: "You need to first, SET PAUSE text, and then SET PAUSE ON if you want text to appear each time SQL*Plus pauses."