Actually, if you are using Oracle 8 or higher, you can use the RETURNING
clause of a DML statement to give you any column.  The syntax is something
like this ..

:
$insJR = $dbh -> prepare (q (
    INSERT
    INTO    IIJobRun (IIJobID, StartTimeStamp)
    VALUES  (:jobid, pkg_Calc.Now)
    RETURNING
            IIJobRunID INTO :jobrunid
    )) ;
:
#
#   Insert the IIJobRun row, and get back the IIJobRunID column value
#
    $insJR -> bind_param (":jobid", $kIIJobID) ;
    $insJR -> bind_param_inout (":jobrunid", \$JobRunID, 10) ;
    $insJR -> execute ;

This is an extract from an actual script, so I apologize if it doesn't mean
much to you.

Hope this helps,

Steve

-----Original Message-----
From: Jim Spath [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 09, 2001 5:22 AM
To: Gregory; [EMAIL PROTECTED]
Subject: Re: How can I get insert_id from DBD::Oracle?


There is no DBD::Oracle equivalent for retrieving the value of 
insert_id.  You must create a sequence within oracle, then retrieve its 
value and assign it to a variable within your script.  You can then use 
that value when you execute your insert and later in your script.

Jim

At 12:14 PM 6/8/01 -0700, Gregory wrote:
>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)?
>
>Thanks. Grisha.


#!/usr/local/bin/perl

push@J,[($")x70]for 0..20;sub
p{$J[$q][$p]=$_;print"\e[H\e[J";print@$_,$/for@J
;$J[$q][$p]=$"}sub f{sprintf"%.f",pop}for('Just another Perl
hacker.'=~/./g){$
t=/
/and$J[20][$X++]=$_,next;{$x=70+$t*($X-70)*.8;$y=20-63.25*$t+50*$t**2;last
if$x<$X;$p=f$x;p$q=f$y;$t+=.1;select$,,$,,$,,.1;redo}$J[20][$X++]=$_}p


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************

Reply via email to