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;

In reply to Inserting to a bigint data type in Sybase using prepare statements by j_ochoa

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.