Brett,

Your right. From the DBD::Oracle (v1.12) doco - 

INSERT INTO table (k, v) VALUES (seq_name.nextval, ?)

To get the value just inserted you can use 

SELECT seq_name.currval FROM DUAL

This was from the DBD::Oracle v1.12 doco. I
currently have v1.06!


Regards,

        Stacy.






"Brett W. McCoy" wrote:
> 
> On Wed, 13 Feb 2002, Stacy Mader wrote:
> 
> > #!/usr/local/bin/perl
> >
> > use strict;
> >
> > my $sql = q{
> >   INSERT INTO REPORT
> >     VALUES (REPORT_NUM_SEQ.NEXTVAL,?,to_date(?,'DD-MON-YYYY HH24:MI')
> >          ),
> >       undef, $report, $date_reported
> >     };
> >
> > Where the report number is incremented via the
> > REPORT_NUM_SEQ.NEXTVAL statement (REPORT_NUM_SEQ
> > is an Oracle sequence).
> 
> Can't you do a query and retrieve REPORT_NUM_SEQ.CURRVAL (something like
> SELECT REPORT_NUM_SEQ.CURRVAL) after you do the insert?  That should be
> the value that was just inserted from the sequence (going by my rusty
> Oracle knowledge -- I remember that it was very similar to PostgreSQL's
> sequences, where you would do currval('report_num_seq')).
> 
> -- Brett
>                                           http://www.chapelperilous.net/
> ------------------------------------------------------------------------
> He who invents adages for others to peruse
> takes along rowboat when going on cruise.

Reply via email to