Namek
Namek

Reputation: 487

Oracle Sequence values to file

I wanted to write some PL-SQL script, which will increase the existing sequece of example 10000 times (let say that the current value is "12", so at the end, the current value of sequence will be "10012"), and the script will create an output file, with each executing of .NEXTVAL, so:

13
14
15
...
10012

Upvotes: 0

Views: 281

Answers (1)

Viktor Bardakov
Viktor Bardakov

Reputation: 876

So, in SQL*Plus you can use smth like this

spool myoutputfile.txt
select SEQUENCE_NAME.NEXTVAL from 
(
SELECT ROWNUM AS rn FROM DUAL
        CONNECT BY LEVEL <=10000
) a;
spool off;

Upvotes: 2

Related Questions