How can I alter a sequence in dynamic SQL?
I'm trying to create a script to migrate data from one DB to another. One thing I'm not currently able to do is set the nextval of a sequence to the nextval of a sequence in another DB. I got the difference in values from user_sequences and generated the following dynamic SQL statements: execute immediate 'alter sequence myseq increment by 100'; execute immediate 'select myseq.nextval from dual'; execute immediate 'alter sequence myseq increment by 1'; commit; But nothing happens. What am I missing? If I run the same statements outside the procedure, they work fine: alter sequence myseq