I learned something: If the number of rows affected is not known, then execute() returns -1.
Usually with an SQL statement (UPDATE or whatever), the number of rows affected will be known. This is different because of the execution of a stored procedure.
In my experience, it is relatively easy to translate working command line SQL code into Perl code. I would like to see the command line SQL statements that are claimed to "work".
Update: As I wrote earlier, I've never seen -1 (unknown number of rows affected). A normal SQL UPDATE or INSERT knows that number. The DBI can return the string value of 0EO which evaluates to "true" in a scalar context but is numerically zero in a math context or a number representing the number of rows affected. As I learned, in this situation, a negative number could be returned.
I HIGHLY recommend that you work from the SQL command line to get a valid result. Once you have that, we can make Perl do the same thing. Once we are past that, other optimization can be done about error conditions. Start from known working SQL code. Make Perl do the same thing that you know works. Then go from there.
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link or
or How to display code and escape characters
are good places to start.