Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Perform Subscript from File in PL/SQL
rainer.hirthammer_at_software-objects.com (Rainer Hirthammer) wrote in message news:<3d99b782.8900027_at_news.btx.dtag.de>...
> How can I do this:
> ...
> BEGIN
> @subscript.sql;
> EXCEPTION
> ...
>
> Thanks, Rainer
Rainer, in general you don't. Instead you would write a sqlplus script that executed several plsql scripts.
If you need to run scripts based on information determined in the plsql scripts then you can potentially use a sqlplus variable and have the plsql scripts or sql statements set the variable value and then execute a script where the variable is the script name: start variablescript..sql
You can also sometimes substitute dynamic sql, execute immediate or dbms_sql, for the script.
Also you can use the spool command to create sql files that you populate via select as in select 'select '||col1||... from table_a where ... and then execute these.
Alternately, you have to resort to using extenal procedures or the interprocess communication routines: dbms_alert and dbms_pipe to send commands/information between sessions.
Some combination of the above methods will generally allow you to do what you need. The problem is selecting the best one for the task.
HTH -- Mark D Powell -- Received on Tue Oct 01 2002 - 13:18:06 CDT