资讯   |   开发   |   选机中心   |   产品大全 | IBM | 惠普 | 联想 | 戴尔 | 苹果 | 神舟
更多: | 华硕 | 明基 | 方正 | 紫光 | TCL | 夏新 | 联宝 | 宏碁 | 七喜 | 长城 | 清华同方 | 海尔 | 三星 | 东芝 | 索尼 | 富士通 | LG | 技术 | ddnoon
当前位置:笔记本 > 软件开发 >
Advertisement
文章正文

如何才能改变当前序列的值呢?

类型:转载   责任编辑:asp.net   日期:2007/05/23


热门软件下载:


   

只有删除序列,在重建序列一种办法吗?

网友回答:

发表者:liujiin

一句sql是不能够实现的,还不如直接drop再create呢?  
  比如一个sequence如下  
  --   Create   sequence    
  create   sequence   SEQ_WXTHCOUNT  
  minvalue   1  
  maxvalue   99999999  
  start   with   5523202  
  increment   by   1  
  cache   20;  
  修改当前序列值为23的过程要经过一系列步骤,如下:  
  --   Modify   the   last   number    
  alter   sequence   SEQ_WXTHCOUNT   increment   by   -5523179   nocache;  
  select   SEQ_WXTHCOUNT.nextval   from   dual;  
  alter   sequence   SEQ_WXTHCOUNT   increment   by   1   nocache;  
  declare  
      LastValue   integer;  
  begin  
      loop  
          select   SEQ_WXTHCOUNT.currval   into   LastValue   from   dual;  
          exit   when   LastValue   >=   23   -   1;  
          select   SEQ_WXTHCOUNT.nextval   into   LastValue   from   dual;  
      end   loop;  
  end;  
  /  
  alter   sequence   SEQ_WXTHCOUNT   increment   by   1   cache   20;  
 


 

 
热门推荐笔记本: NEC笔记本
相关文章:
webmaster:popbb@126.com   最佳浏览:1024X768 MSIE
©2007 popbb.net All Rights Reserved