Database Reference
In-Depth Information
file other than the SQL buffer file. A SQL*Plus script is a file containing a
combination of SQL commands, such as queries, and SQL*Plus commands
such as SET and ACCEPT.
The next command instructs SQL*Plus to retrieve and execute the
SQL*Plus script in the file CDREPORT.SQL.
START CDREPORT
Another way to run a script is to use the @ or RUN commands. For
example, you could type each of these two lines, entering the number 3
when prompted for the CD number, trying each variation.
@CDREPORT
RUN CDREPORT
All three of the commands: START, @, and RUN have the same effect.
A fourth way of executing a script is to use @@. This tells SQL*Plus to
run the script and, in addition, to look for any scripts called within this
script in the same directory. This is very useful when you are creating a
series of scripts that call one another. With this method you only need to
tell SQL*Plus where the first script is located and it can find all the others,
assuming you located them in the same directory. For example, imagine
you have three scripts named A.SQL, B.SQL, and C.SQL in the C:\TEMP
directory /tmp on UNIX. The script A.SQL has an SQL*Plus command to
run the B.SQL and B.SQL calls C.SQL. You could start the primary script
by typing this command. The other two scripts will be found because they
are stored in the same directory.
@@C:\TEMP\A
The double @@ command simply tells SQL*Plus to use the current
directory to search for contained scripts as in the following:
SET SERVEROUTPUT ON;
EXEC DBMS_OUTPUT.PUT_LINE('Executing A.SQL');
@@B.SQL;
EXEC DBMS_OUTPUT.PUT_LINE ('Completed A.SQL');
SET SERVEROUTPUT OFF;
Search WWH ::




Custom Search