Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

What DBD are you using?

From the DBI docs:

If any arguments are given, then "execute" will effec- tively call "bind_param" for each value before execut- ing the statement. Values bound in this way are usu- ally treated as "SQL_VARCHAR" types unless the driver can determine the correct type (which is rare), or unless "bind_param" (or "bind_param_inout") has already been used to specify the type.

So maybe the driver that you are using is guessing incorrectly as to the type of "2 89" and it treating it as an integer. If that is the case, it looks as if you might have stumbled upon a bug in the DBD.

Try doing a DBI->trace(2) (or higher up to level 9) to see what is going on inside the DBI/DBD, and if you are still stumped or if it looks like there might be a bug, post the information to dbi-users.

In the meantime you can probably explicity spell out the bind type of that placeholder using bind_param():

$insert_cmd = "INSERT INTO PhoneNumbers (cusID, adtID, pntID, phnPart1, phnPart2, phnPart3, phnExt) VALUES (?, ?, ?, ?, ?, ?, ?)"; $phone_insert = $gcssDBH->prepare($insert_cmd); $phone_insert->bind_param(6,undef,SQL_VARCHAR); #bind undef -- execute + will remember the bind type $phone_insert->execute( $row->{'cust_id'}, $adtID, $phoneNumberTypes->{'Day'}, $row->{'cust_phac'}, $row->{'cust_phpx'}, $row->{'cust_phsx'}, $row->{'cust_phex'} );

In reply to Re: Using placeholders, getting unexpected SQL errors by tantarbobus
in thread Using placeholders, getting unexpected SQL errors by ok

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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> <u> <ul>
  • 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 intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (2)
As of 2024-04-20 10:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found