artful, Appears you are curious as what the name of the column that contains the incremented value is...not what the value of the last insert was from the previous insert.

Sounds like you are looking for a description of the table itself. Since you mention describe, I am thinking you are talking about Oracle. (although as you can see from the forthcoming example, via oracle you would(should) use the sequenced column in the insert..so maybe I assume wrong) Anyway, here is an oracle way...

a typcial sequence that is tied to a column during an insert:

create sequence seq_name start with 1 increment by 1 maxvalue 999999 nocycle cache 20; create public synonym seq_name for owner.seq_name; grant select on seq_name to joe_user;

With above created, you now do the insert like so:

insert into table (seq_col, cola, colb, colc) values (seq_name.NEXTVAL, 'data','moredata','otherdata')

Now I guess it's quite possible that the technique currently being used does not list the columns prior to the values...ala

insert into table values (seq_name.NEXTVAL, 'data','moredata','otherdata')

...therefore you are not seeing the column name...if this is the case, modify the sql to use all the columns (you'll probably need the describe at this point...but just once, since you now have the column name in the sql). Note that doing an insert "by position" (without naming the columns prior to values) can get you into trouble if the table is ever altered without warning (that never happens, eh? :-))

anyway hope I was at least close on this one...

good luck


In reply to Re: How do I find what column $dbh-{'insert_id'} was inserted into? by wardk
in thread How do I find what column $dbh-{'insert_id'} was inserted into? by artful

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.