Hello Shreyak,

As everybody suggested, I think there might be a really small syntax mistake at your code. Provide us with a short script to take a closer look.

By the way I found this piece of code:

$dbh->do('INSERT INTO a_table ...'); my $id = $dbh->last_insert_id(undef, undef, qw(a_table a_table_id)) or die "no insert id?";

Taken from MySQL Perl DBI last_insert_id. Take a look, maybe you will see a difference on your syntax.

Update:

Forgot to mention that also SELECT LAST_INSERT_ID() the MySQL query will also do the job. You can read more about it here LAST_INSERT_ID(), LAST_INSERT_ID(expr).

Hope this helps.

Seeking for Perl wisdom...on the process...not there...yet!

In reply to Re: last_insert_id() in sybase by thanos1983
in thread last_insert_id() in sybase by Shreyak

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.