drop 掉
重新创建不行么?
重新创建不行么?
解决方案 »
- Oracle如何实现联查的TOP1
- 求指导迷津!!!!!!!!!!!!!
- 进行oracle数据库开发用什么语言好?
- 无法初始化ocr
- Oracle企业管理器中关闭数据库需要填主机用户和密码,vista homepremium,请问怎么填?我以管理员登陆,并填了信息,结果说主机密码错误,怎么解决
- 如何将查询获得的序列名 在插入语句中使用?急!求解!
- 用 to_number(表字段名(varchar),'999999999'.99) 怎么出错??? 是不是不能对字段用to_bumber呀?急??
- 请教牛人,如何用 sql语句实现?
- 为什么不能安装?
- 如何求一日期字段或日期变量的上月月底日期?
- 新手变量定义的问题(急)
- 求教,关于数据库系统的开发过程
1、sequence_name;2、nextval;3、increment by
然后执行循环,每次查找序列的nextval,直到序列的currval等于设置值才结束
alter sequence SP_TEST
increment by 1
cache 20;
-- Modify the last number
alter sequence SP_TEST increment by 2 nocache;
select SP_TEST.nextval from dual;
alter sequence SP_TEST increment by 1 nocache;
declare
LastValue integer;
begin
loop
select SP_TEST.currval into LastValue from dual;
exit when LastValue >= 1 - 1;
select SP_TEST.nextval into LastValue from dual;
end loop;
end;
/
alter sequence SP_TEST increment by 1 cache 20;
create or replace function SF_SET_SEQ_NEXTVAL2(vcSeqName in varchar2, lNextVal in number) return number is
Result number;
lMinVal number;
lMaxVal number;
lIncVal number;
lCycle number;
lOrder number;
lCache number;
sCycle varchar2(10);
sOrder varchar2(10);
sCache varchar2(10);
begin
-- 悵湔橾腔SEQ統杅
select s.increment$, s.minvalue, s.maxvalue, s.cycle#, s.Order$, s.cache
into lIncVal, lMinVal, lMaxVal, lCycle, lOrder, lCache
from sys.obj$ o, sys.seq$ s, sys.user$ u
where u.name = sys.login_user() and
u.user# = o.owner# and
o.name = upper(vcSeqName) and
o.obj# = s.obj#;
if lCycle = 0 then sCycle := 'nocycle'; else sCycle := 'cycle'; end if;
if lOrder = 0 then sOrder := 'noorder'; else sOrder := 'order'; end if;
if lCache <= 0 then
sCache := 'nocache';
else
sCache := 'cache '||lCache;
end if;
-- 刉壺SEQ
Execute immediate 'drop sequence '||upper(vcSeqName)||';';
-- 笭膘SEQ
Execute immediate
'create sequence '||vcSeqName||' minvalue '||lMinVal||' maxvalue '||lMaxVal||' start with '||lNextVal||' increment by '||lIncVal||' '||sCycle||' '||sOrder||' '||sCache||';';
Result := 0;
return(Result);
end SF_SET_SEQ_NEXTVAL2;但是编译的时候取报“必须指明标识符sys.obj$”,我改成其它表名试了试可以,难道在存储过程中不能使用sys.obj$吗?