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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Sequences ?

Re: Sequences ?

From: Arjan van Bentem <avbentem_at_DONT-YOU-DAREdds.nl>
Date: Fri, 23 Apr 1999 16:46:18 +0200
Message-ID: <7fq13e$37s$1@weber.a2000.nl>


Martin Fuks wrote
> Do you know how to syncronize a sequence with the maximum
> value in a field in a table?

If it is just a few records, you could simply execute a loop with

    select my_sequence.next_val
    from dual;

until you reach the maximum value that exists in your table. If it is more than just a few rows then you'd need an alter sequence to set the increment_by part, select a next_val only once and again issue an alter sequence to get the original sequence behavior.

Please let us know how many tables are involved, for I did have some script to do this but would need to restore a backup to get it for you.

Arjan. Received on Fri Apr 23 1999 - 09:46:18 CDT

Original text of this message

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