Perl DBI - run SQL Script with multiple statements

Posted by guigui42 on Stack Overflow See other posts from Stack Overflow or by guigui42
Published on 2009-08-05T12:29:14Z Indexed on 2010/05/27 15:41 UTC
Read the original article Hit count: 230

Filed under:
|
|

I have a sql file test.sql used to run some SQL (create object / update / delete / insert) that can look like this

    CREATE TABLE test_dbi1 (
    test_dbi_intr_no    NUMBER(15)
  , test_dbi_name       VARCHAR2(100);

UPDATE mytable 
SET col1=1;

  	CREATE TABLE test_dbi2 (
    test_dbi_intr_no    NUMBER(15)
  , test_dbi_name       VARCHAR2(100);

Usually, i would just use SQLPLUS (from within Perl) to execute this test.sql using this command : @test.sql

Is there a way to do the same thing, using DBI in Perl ? So far, i found DBI can only execute one statement at a time, and without the ";" at the end.

© Stack Overflow or respective owner

Related posts about perl

Related posts about Oracle