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