Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: run a script in a PRO*C procedure !

Re: run a script in a PRO*C procedure !

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Mon, 24 Jan 2000 14:26:59 -0500
Message-ID: <ci9p8sc73gsvknf3n7463s6rejf3jh3292@4ax.com>


A copy of this was sent to "Olivier BRUZEAUX" <obruzeau_at_telecom.capgemini.fr> (if that email address didn't require changing) On Mon, 24 Jan 2000 17:41:19 +0100, you wrote:

>
>Is it possible to run a sql script (script.sql) from a PROC*C procedure
>(file.pc):
>
>Example:
>EXEC SQL "I want to run script.sql"
>
>Thanks,
>
>Olivier
>

it could be:

   system( "sqlplus user/pass @script.sql" );

running scripts is a SQLplus'ism. SQLPlus is the only thing that understands the "set define off", "set arraysize 15", "break on C1 skip 1", compute sum of sal on report" and so on.

If you have a bunch of sql in a script file to execute, you can use fopen, fread, and so on in C to read the commands to execute and then "execute immediate :that_command" one at a time.

--
See http://osi.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'... Current article is "Part I of V, Autonomous Transactions" updated June 21'st  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Mon Jan 24 2000 - 13:26:59 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US