CREATE OR REPLACE PROCEDURE "SEQ_SET_ZERO" (resultes out varchar2) is
cursor cur_seq is
select t.sequence_name,t.min_value,t.increment_by,t.last_number
from user_sequences t;
v_sequence_name varchar2(50);
v_min_value varchar2(50);
v_increment_by varchar2(50);
v_last_number varchar2(50);
/*
author :football98
date : 2015-02-04
description : 初始化序列。慎用
*/
begin
/*显示声明权限*/
execute immediate 'grant create sequence to sbkfw';
execute immediate 'grant drop any sequence to sbkfw';
open cur_seq;
fetch cur_seq into v_sequence_name,v_min_value,v_increment_by,v_last_number;
while cur_seq %found loop
/*删除序列:*/
execute immediate 'drop sequence '||v_sequence_name;
/*创建序列:*/
execute immediate 'create sequence '||v_sequence_name||' minvalue 1 start with 1 increment by 1';
fetch cur_seq into v_sequence_name,v_min_value,v_increment_by,v_last_number;
end loop;
close cur_seq;
resultes := '操作成功' ;
commit;
exception
when others then
rollback;
resultes := '操作失败';
end seq_set_zero;
cursor cur_seq is
select t.sequence_name,t.min_value,t.increment_by,t.last_number
from user_sequences t;
v_sequence_name varchar2(50);
v_min_value varchar2(50);
v_increment_by varchar2(50);
v_last_number varchar2(50);
/*
author :football98
date : 2015-02-04
description : 初始化序列。慎用
*/
begin
/*显示声明权限*/
execute immediate 'grant create sequence to sbkfw';
execute immediate 'grant drop any sequence to sbkfw';
open cur_seq;
fetch cur_seq into v_sequence_name,v_min_value,v_increment_by,v_last_number;
while cur_seq %found loop
/*删除序列:*/
execute immediate 'drop sequence '||v_sequence_name;
/*创建序列:*/
execute immediate 'create sequence '||v_sequence_name||' minvalue 1 start with 1 increment by 1';
fetch cur_seq into v_sequence_name,v_min_value,v_increment_by,v_last_number;
end loop;
close cur_seq;
resultes := '操作成功' ;
commit;
exception
when others then
rollback;
resultes := '操作失败';
end seq_set_zero;