how to invoke .sql file from dbi



Hello all,

We have bunch of sql files ( .sql ) that we want to invoke from dbi ( Oracle ).
How does it work. Dbi expects actual sql statements to be given as it's
arguments whether in case of do() or prepare() methods. I wonder is there any option
to just point the dbi to a sql file and dbi taking care of it. I do understand that running
sql file is sqlplus feature and may not be applicable to dbi, as dbi is more generic. We have
hundreds of sql files to be run like this. Each sql file has multiple sql statements within it.

I know these are my options..

1) Parse sql files and assign each sql statement to string variable and pass the string as an argument to do().
File handler routines may come in handy for this.
2) Do not use DBI. Instead call 'sqlplus' from perl itself with file as input parameter.

Did anyone come across this. Is there any simple way to do this.

Thanks,
Ravi
.



Relevant Pages

  • RE: Question with DBI versus PERL
    ... Question with DBI versus PERL ... statement at once (if I parse my SQL file) my pl/sql will work? ... All spool statements will turn to Perl print() calls. ... I want to know how can i run this sql script with DBI. ...
    (perl.dbi.users)
  • RE: how to invoke .sql file from dbi
    ... recommended changing all the SQL*Plus scripts into DBI calls. ... The sql statements are SELECT statements and we are expecting plain (no ... to just point the dbi to a sql file and dbi taking care of it. ...
    (perl.dbi.users)
  • Re: use of DBI; I am getting multiple error messages mixed in with the correct output.
    ... T> expected a mature library like DBI to behave like this. ... I learned plenty about the perl side of things from her posts. ... closely represent the SQL idea of a null. ... trivially easy to perform bulk loads using the DB's particular ...
    (comp.lang.perl.misc)
  • Re: how to invoke .sql file from dbi
    ... The sql statements are SELECT statements and we are expecting plain output from these statements. ... But it is little surprising that dbi doesn't support executing sql files directly. ... The anonymous PL/SQL block would be a way to avoid parsing all of it and executing it as individual statements, but still executing it via DBI without calling out to sql*plus. ...
    (perl.dbi.users)
  • RE: New DBI in-memory tables, heterogeneous operations, SQL-Statement
    ... SQL ERROR: Bad predicate: 'id'! ... New DBI in-memory tables, heterogeneous operations, ... > functions, in-memory tables, and heterogeneous operations across all DBI ... > As with AoA in-memory tables, once a heterogeneous query in-memory table ...
    (perl.dbi.users)

Quantcast