> Any tips/hints/help/advice please, please, please folks?
> $rows = $dbh->do("\@/home/bill/sql/run.sql");
the "@" function is a sqlplus command, not a sql. So to accomplish
this you'd need the following steps:

1. open script file.
2. read command (as single command) to $some_variable_here
3. do/(prepare/execute)

so... (add error checking)

open( IN, "< script.sql" );

my $sql = join( "", <IN> );

close(IN);

$dbh->do($sql);


If you've any "sqlplus" commands: column, set, !, etc. then the do will
fail.  sqlplus filters its commands before sending the statement to
the database.

In the next release of DBI::Shell, a command to run script is
provided:

/run /path/to/script/name.sql

or using batch mode

dbish --batch < /path/to/script/name.sql

Where the above read/do only supports one statement per file, dbish in
batch mode supports any number.
Unfortunately, the same thing applies about "sqlplus" commands.
(A plug-in called SQLMinus is in the works ... no release date at this
time.)

Tom

On Sat, Apr 07, 2001 at 09:47:22AM +0100, Bill Parker wrote:

> The majority of which is, I'm afraid, simply example filched from the
> O'Reilly Perl-DBI book (thanks Alligator(?) & Tim)
> 
> However, one thing I cannot seem to do is run a (supplied by the Oracle DBA)
> sql script... I've tried ->do, I've tried the 4-step prepare, execute,
> finish, fetch, deallocate but the same error message occurs.. ORA-00900
> (invalid SQL)
> 
> Heres a brief example....
> 
> 
> I also tried "@....run.sql" & "run .../run.sql" with no joy
> 
> As I said, the O'Reilly book IS superb - but all it gives me in this
> instance is a "How to call a PL/SQL procedure"
> 

-- 
Thomas A. Lowery
See DBI/FAQ http://tlowery.hypermart.net

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Reply via email to