alter sequence YOUR_SEQ increment by &new_value-&actual_position nocache;
select YOUR_SEQ.nextval from dual;
alter sequence YOUR_SEQ increment by 1 nocache;
declare
LastValue integer;
begin
loop
select YOUR_SEQ.currval into LastValue from dual;
exit when LastValue >= &new_value - 1;
select YOUR_SEQ.nextval into LastValue from dual;
end loop;
end;
/
alter sequence YOUR_SEQ increment by 1 cache 20;
Regards,var x_n number ;
alter sequence SEQ_one increment by -1 ;
begin
select SEQ_one.nextval into :x_n from dual ;
while ( :x_n > 1 )
Loop
select SEQ_one.nextval into :x_n from dual ;
end loop ;
exception when others then
if SQLCODE=-8004 then null ;
else raise ;
end if ;
end ;
/
alter sequence SEQ_one increment by 1 ;
var last number ;
begin
select the_last_number into :last from dual ;
for i in 1..:last loop
select SEQ_one.nextval into :x_n from dual ;
end loop ;
end ;
/
!http://download.oracle.com/docs/cd/B14117_01/server.101/b10759/alter_sequence.gif! ALTER SEQUENCE seq_x INCREMENT BY -99;
SELECT seq_x.NEXTVAL FROM dual;
will produce 1.ALTER SEQUENCE seq_x INCREMENT BY 1;
SELECT seq_x.NEXTVAL FROM dual;
SELECT seq_x.NEXTVAL FROM dual;
will produce 2 and 3. alter sequence seq increment by (desired_value-current_value);
select seq.nextval from dual;
alter sequence seq increment by (old_increment);
Bartek