Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How can I call a SQL Plus script from a PL/SQL script?
I think youhave it backwards. I think his question is how does he
call a SQL Plus script from the Anonymous Block. I have the same
problem and can't figure it out.
For example, I have a script called script.sql. It has DDL and SQL commands. At the SQL Plus prompt I can type 'run sript.sql' (or @script.sql) to run it and it executes with no problem
Now I need to execute it from the PL/SQL block as follows:
DECLARE
...
BEGIN
LOOP
run script.sql -- *** This is what I can't do ***
END LOOP
END
Can you help us?
On Tue, 16 Jul 2002 15:36:49 GMT, Daniel Morgan <dmorgan_at_exesolutions.com> wrote:
>mbiker wrote:
>
>> I have some SQL Plus scripts that help me load data. I now need to
>> add some more complicated logic so PL/SQL is required. The PL/SQL
>> will need a loop which calls the existing SQL Plus scripts passing a
>> date.
>>
>> Is this possible?
>>
>> Rewriting the existing SQL Plus scripts to use PL/SQL would be a large
>> job. These scripts work and have been in production for a while. I
>> would like to avoid making major changes.
>>
>> Thanks,
>> Don
>
>What you are looking for is an 'anonymous block'.
>
>DECLARE
>-- your variables here
>BEGIN
>-- your code here inlcuding loops, IF-THEN-ELSE, whatever
>END;
>
>Or a stored procedure if you want to store it permanently in the database.
>
>Daniel Morgan
>
Received on Tue Jul 16 2002 - 13:19:06 CDT
![]() |
![]() |