Hi,

I've to remove the existing sequences in a schema & then i've to recreate
those sequences with START WITH to old sequences current value.

I've written a script as follows,to recreate current sequences after droppping them,

select 'create sequence ' || sequence_name || ' start with ' ||
' increment by ' || INCREMENT_BY || ' minvalue ' || MIN_VALUE ||
' maxvalue ' || MAX_VALUE || ' CACHE ' || CACHE_SIZE || ' ' || case when cycle_flag='Y' then ' CYCLE ' end
from user_sequences;

Now the problem in this script is,I'm not able to set START WITH current values of the sequence,

I tried with LAST_NUMBER,but it doesn't work for sequence which set with CACHE option.

So,correct my script & guide me to get a script,that gives what i needed.

Thanks