Phoenix.pm: PERL-SQL question

Scott Walters phaedrus at illogics.org
Wed Jan 30 16:52:31 CST 2002


N,

1. Don't ignore failure. It's failing for a reason.
2. Add this to your die statement: (I can't remember what your DBI handle is 
called so I'm calling it $dbh in this example:)
  $dbh->execute("sql here") or die("died! reason? maybe! " . $dbh->err);
  This will get the error message from DBI so we can see what went wrong.
  Post this back to the list - the source code and the output in the
  same message - and I'll take another hack at it.
3. This same approach should work to inserting text files. If the
text files have ' marks in them, you can escape them:
$file =~ s/'/''/g;
4. You mentioned you were having a hard time splitting on |. It is
a regex special character, so you have to put a backslash in front of it
to use it as a normal character: @ar = split /\|/, $string;

Now, run that again, and tell me what the die message is...

-scott

On Wed, 30 Jan 2002, N wrote:

> Hi
> I put in the print statement like you said and got the
> following message.
> 
> INSERT into utilization (id,tester_name,ww,util)VALUES
> ('TER01','04','98.60% ')
> Could not execute sql statement: at
> C:\Perl\perfloader.pl line 32, <NISHANT> line 6.
> 
> it is inserting the first line and then errors out at
> the last line.
> The wierd thing is I use the same ODBC connection and
> can do inserts into the very same db from command
> line/user input.
> I pasted the insert statement using the SQL Enterprise
> manager and the insert syntax works okay
> Thanks for your help
> Rgds
> NP
> 
> __________________________________________________
> Do You Yahoo!?
> Great stuff seeking new owners in Yahoo! Auctions! 
> http://auctions.yahoo.com
> 




More information about the Phoenix-pm mailing list