SQL> create sequence ots_seq;
Sequence created.
SQL> select ots_seq.nextval from dual ;
NEXTVAL
———-
1
SQL> /
NEXTVAL
———-
2
SQL> /
NEXTVAL
———-
3
SQL> /
NEXTVAL
———-
4
SQL> /
NEXTVAL
———-
5
CREATE or REPLACE PROCEDURE reset_seq (seq_name IN VARCHAR2) as
curr_val INTEGER;
BEGIN
EXECUTE IMMEDIATE ‘alter sequence ‘ ||seq_name||’ MINVALUE 0′;
EXECUTE IMMEDIATE ‘SELECT ‘ ||seq_name ||’.nextval FROM dual’ INTO curr_val;
EXECUTE IMMEDIATE ‘alter sequence ‘ ||seq_name||’ increment by -‘||curr_val;
EXECUTE IMMEDIATE ‘SELECT ‘ ||seq_name ||’.nextval FROM dual’ INTO curr_val;
EXECUTE IMMEDIATE ‘alter sequence ‘ ||seq_name||’ increment by 1′;
END reset_seq;
/
Procedure created.
SQL> exec reset_seq(‘ots_seq’);
PL/SQL procedure successfully completed.
SQL> select ots_seq.nextval from dual ;
NEXTVAL
———-
1
SQL>
Have actually been taking little over a month.
안녕하세요..
저번에 저자님의 책도 구해서 잘보고 있습니다.
다름이 아니라, 시퀀스 초기화 하는 프로서저를 만들었는데요
프로시저는 A 유저에게 만들고, 실행은 B 유저가 합니다.
근데, 프로시저를 호출해서 실행을 하면 에러는 발생하지 않고 정상적으로 동작하는데
시퀀스를 호출해보면 초기화가 되지 않습니다.
프로시저 내의 각 스텝별로 별도로 실행하면 초기화가 잘 됩니다.
원인이 뭔지 궁금합니다.
권한 문제가 아닐까 추측 됩니다.
sqlplus 에서 SQL> set serveroutput on
을 주시고 프로시저를 수행해보세요…
프로시저 수행이 왜 실패한건지 메시지가 보일것 입니다.
Have been taking little over a month.
I by no means even carried purposes for it!
Hello there! This is my 1st comment here so I just wanted to give a quick shout out and say I really enjoy reading your posts.
Can you suggest any other blogs/websites/forums that go
over the same subjects? Thank you!
If you are planning to obtain a camera then there’s one tip that may help you find the perfect one.
There is plenty more info regarding investing in a
photographic camera, and I encourage you to definitely keep understading about this important topic.
All the pans and zooms need to be a great deal slower as a result of convergence.