Cambio en secuencia
Tengo creada una secuencia y quiero modificar el valor actual de la misma. ¿Como se puede hacer? Se me ha ocurrido eliminarla y volverla a crear poniendole como punto de inicio el valor que deseo, pero supongo que se podrá hacer de otra manera.
Gracias por anticipado.
Mikel
Gracias por anticipado.
Mikel
Hola Mikel...
Lamento decirte q no hay manera de modificar los valores de las secuencias.... solo puedes incrementarla con el Next.Value
Para ello tendrÃas q eliminarla y crearla nuevamente y colocandole el valor inicial q desees.
Saludos...
Espero ayudarte.
Lamento decirte q no hay manera de modificar los valores de las secuencias.... solo puedes incrementarla con el Next.Value
Para ello tendrÃas q eliminarla y crearla nuevamente y colocandole el valor inicial q desees.
Saludos...
Espero ayudarte.
Yo uso el PL/Sqldeveloper y de ahà saqué este código que te permite cambiar una secuencia
La misma tenÃa el número 740 como next y le puse 100 y me generó lo siguiente:
-- Modify the last number
alter sequence SEQ_COTIZA_PRE increment by -640 nocache;
select SEQ_COTIZA_PRE.nextval from dual;
alter sequence SEQ_COTIZA_PRE increment by 1 nocache;
declare
LastValue integer;
begin
loop
select SEQ_COTIZA_PRE.currval into LastValue from dual;
exit when LastValue >= 100 - 1;
select SEQ_COTIZA_PRE.nextval into LastValue from dual;
end loop;
end;
/
alter sequence SEQ_COTIZA_PRE increment by 1 nocache;
La misma tenÃa el número 740 como next y le puse 100 y me generó lo siguiente:
-- Modify the last number
alter sequence SEQ_COTIZA_PRE increment by -640 nocache;
select SEQ_COTIZA_PRE.nextval from dual;
alter sequence SEQ_COTIZA_PRE increment by 1 nocache;
declare
LastValue integer;
begin
loop
select SEQ_COTIZA_PRE.currval into LastValue from dual;
exit when LastValue >= 100 - 1;
select SEQ_COTIZA_PRE.nextval into LastValue from dual;
end loop;
end;
/
alter sequence SEQ_COTIZA_PRE increment by 1 nocache;
