Hi all,
I have a problem trying to insert into a column with data type as bigint and any help is much appreciated.
Database: Sybase
The error I get from the database is this:
Couldn't prepare statement: Server message number=257 severity=16 state=1 line=0 server=DEVEL1 procedure=DBD3 text=Implicit conversion from datatype 'VARCHAR' to 'BIGINT' is not allowed. Use the CONVERT function to run this query.
token_id column is a bigint data type
The conflicting line is where binding parameter 7
The code looks like this:
my $insert_sth = "INSERT INTO some_table
(transaction_id, ccn_masked, cardholder_name, exp_month, exp_year,
+ card_type, token_id )
VALUES(?, ?, ?, ?, ?, ?, ? )";
my $q_result = $dbh->prepare($insert_sth) or die "Couldn't prepare sta
+tement: " . $dbh->errstr;
$q_result->bind_param(1, $txId, { TYPE => SQL_INTEGER } );
$q_result->bind_param(2, $add_data{'maskedccn'});
$q_result->bind_param(3, getCardholderName($self));
$q_result->bind_param(4, getExpMonth($self), { TYPE => SQL_INTEGER
+ });
$q_result->bind_param(5, getExpYear($self), { TYPE => SQL_INTEGER
+});
$q_result->bind_param(6, getCardType($self));
$q_result->bind_param(7, 5114780000000000271, { TYPE => SQL_BIGINT
+ } );
$q_result->execute()or die "Couldn't prepare statement: " . $dbh->errs
+tr;
-
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.