Sequence in ORACLE, such as returning to a previous value or modifying its current value

0

Let's say I have this sequence

CREATE SEQUENCE "NOMBRE_DB"."MI_SECUENCIA"  MINVALUE 0 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 21 CACHE 20 NOORDER  NOCYCLE ;

And we want to check your status to alter its value

    
asked by Saul Salazar 17.08.2018 в 19:33
source

1 answer

0

It would be like this, in oracle we make these queries supposing that the sequence goes in 10 and goes from 1 to 1 and we want to return to 1, the sequence must have a minimum value of 0.

Query to see where the account is going

select MI_SECUENCIA.nextval from dual;

Query to subtract what is needed to go back to 1 in this case

alter sequence MI_SECUENCIA increment by -10;

Then:

alter sequence MI_SECUENCIA increment by 1;
    
answered by 17.08.2018 / 19:34
source