On Fri, Jun 08, 2001 at 12:24:33PM -0700, Kokarski, Anton wrote:
> Greg,
> 
> Look around on mysql.com I've seen a mentioning of the utility that allows
> you to port MySQL to oracle.  I think it comes from Oracle.

And is a mostly hopeless marketing tick box gimmick.

> I'm migrating from MySQL to Oracle. When I'm executing "INSERT... " with
> DBD::mysql I could get the id of inserted row with  DBH->{mysql_insertid}.
> Is there any way to do the same thing with Oracle (DBD::Oracle)?

For maximum perfomance I'd suggest selecting from an Oracle 'sequence'
before you do the insert.

But for minimal app code change I'd suggest a using a PL/SQL trigger
that implements the auto increment functionality and saves the last
value into a per-session package variable.

If you, or anyone, does the latter then I'd be very interested in
having a copy as I'll need to do something like that soon myself.

[There's even an undocumented magic hook in the DBI that lets you
emulate other drivers private attributes by storing a code ref
into the attribute :-) That you you can emulate the mysql_insertid
attribute. In theory. I've never tried it.]

Tim.

Reply via email to