Thread: getting the currval of a sequence

getting the currval of a sequence

From
Fran Fabrizio
Date:
Hi all,

I need to do the equivalent of:

 select my_sequence.CURRVAL from Sys.dual;

so I'm guessing its:

 select currvar('my_sequence') from ???????;

Can anyone fill in the ????  Thanks!

-Fran


Re: [GENERAL] getting the currval of a sequence

From
dustin sallings
Date:
On Fri, 14 Aug 1998, Fran Fabrizio wrote:

    If you've recently done an insert and want to know what the value
was, you can do this:

    select last_value from mysequence;

//
// Hi all,
//
// I need to do the equivalent of:
//
//  select my_sequence.CURRVAL from Sys.dual;
//
// so I'm guessing its:
//
//  select currvar('my_sequence') from ???????;
//
// Can anyone fill in the ????  Thanks!
//
// -Fran
//
//
//

--
SA, software.net         My girlfriend asked me which one I like better.
pub  1024/3CAE01D5 1994/11/03 Dustin Sallings <dustin@spy.net>
|    Key fingerprint =  87 02 57 08 02 D0 DA D6  C8 0F 3E 65 51 98 D8 BE
L_______________________ I hope the answer won't upset her. ____________


Re: [GENERAL] getting the currval of a sequence

From
Vadim Mikheev
Date:
dustin sallings wrote:
>
> On Fri, 14 Aug 1998, Fran Fabrizio wrote:
>
>         If you've recently done an insert and want to know what the value
> was, you can do this:
>
>         select last_value from mysequence;

NO! This is wrong!

Use currval('_seq_name_') !!!

>
> //
> // Hi all,
> //
> // I need to do the equivalent of:
> //
> //  select my_sequence.CURRVAL from Sys.dual;
> //
> // so I'm guessing its:
> //
> //  select currvar('my_sequence') from ???????;
> //
> // Can anyone fill in the ????  Thanks!
> //

Vadim