Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Reproduce mysql "auto increment" in Oracle, using Perl?

Reproduce mysql "auto increment" in Oracle, using Perl?

From: <uqmoore_at_my-deja.com>
Date: Mon, 25 Sep 2000 17:13:47 GMT
Message-ID: <8qo13o$uck$1@nnrp1.deja.com>

What's the best way to mimic mysql's "auto increment" feature in Oracle, using Perl?

In mysql, you can set a column as "auto increment". Thus, when you insert a new row and specify NULL for this auto increment column's value, it automatically gives this column the integer value of the previously submitted row, plus one.

The other neat thing is that mysql returns this column's value back to Perl ($sth->{'insertid'}).

I am familiar with Oracle sequences but I do not know how to get the sequence value that was inserted with the new record back to Perl. I don't believe I can simply query the sequence's current value since there's no guarantee that another insert won't happen before this query (right?). I prefer not to lock the table. Any ideas?!?!? Thanks in advance.

QM

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Mon Sep 25 2000 - 12:13:47 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US