创建存储过程,重建sequence,不执行重建

nicholasvb 2020-11-11 02:52:54

创建存储过程,重建sequence, 这个存储过程发现,SEQ_2460H序列是删除了,但是没有重建,是咋回事?

create or replace procedure RebuildSeqH as
n_count number(8);
v_code NUMBER;
v_errm VARCHAR2(64);
begin
select count(1)
into n_count
from user_sequences t
where t.sequence_name = 'SEQ_2460H';

if n_count > 0 then
execute immediate 'drop sequence ' || 'SEQ_2460H';
end if;

execute immediate 'create sequence ' || 'SEQ_2460H' || ' minvalue 1 maxvalue 999 start with 1 increment by 1 NOCYCLE cache 20';

exception
when others then
v_code := SQLCODE;
v_errm := SUBSTR(SQLERRM, 1, 64);
DBMS_OUTPUT.PUT_LINE('' || v_code || ':' ||
v_errm);
end;
...全文
121 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
卖水果的net 2020-11-12
  • 打赏
  • 举报
回复
动态执行 create sequence , 需要对当前用户显式授权。 这个语法的规定(或者说是要求)
grant create sequence to 当前用户名

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧