Thanks to all who have responded...! All your input is much appreciated...

These files have comments included... in some cases there are commented out DROP TABLE 
statements... I will probably have to weed those out as well I suppose. 

Thanks again..

> -----Original Message-----
> From: Jeff Zucker [mailto:[EMAIL PROTECTED]
> Sent: Thursday, February 27, 2003 8:36 AM
> To: Fernando Luna
> Cc: [EMAIL PROTECTED]
> Subject: Re: Running SQL from files - was: Your DBI book
> 
> 
> Fernando Luna wrote:
> 
> >>>What I'd like to do is read a file that contains DDL 
> >>>statements and execute them through these modules.
> >>>
> 
> Most of my test scripts use the following format for DDL and it will 
> work just as well with file data:
> 
>     $dbh->do($_) for split /;\n/, join('', <DATA>);
>     __DATA__
>     DROP TABLE IF EXISTS phrases;
>     CREATE TABLE phrases (
>           id     INTEGER,
>           phrase CHAR(40)
>     );
>     INSERT INTO phrases VALUES (1,'TIMTOWTDI');
>     INSERT INTO phrases VALUES (2,'JAPH');
> 
> >It would be nice to have something pre-packaged, but I 
> wasn't really expecting that. SQL::Statement will parse it 
> out... that's nice, but, I mean, what's to stop me from 
> writing something that detects the ';' and then try to run 
> everything right up to it?
> >
> I don't think SQL::Statement will be of much use to you for 
> this.  You 
> don't really want the statements parsed, you just want them 
> fed directly 
> to ORACLE.  One problem you may be facing in your current approach is 
> the semicolons -- remember they may have to be stripped off 
> before being 
> passed to a $dbh->do(), at least some DBDs don't want to see 
> the semicolons.
> 
> -- 
> Jeff
> 
> 

Reply via email to