`

Dont't recreate the sequence! You would invalidate all independent objects and l

阅读更多

原文出处:https://community.oracle.com/message/4016489#4016489

 

Dont't recreate the sequence! You would invalidate all independent objects and lose all privileges granted for the sequences.
Instead try this:

SQL>CREATE SEQUENCE SEQ_TEST
  2   START WITH  1
  3   INCREMENT BY  1
  4   MINVALUE  1
  5   MAXVALUE  9999999;

Sequence created.

SQL>
SQL>SELECT SEQ_TEST.NEXTVAL
  2    FROM all_objects WHERE ROWNUM < =10;

   NEXTVAL
----------
         1
         2
         3
         4
         5
         6
         7
         8
         9
        10

10 rows selected.

SQL>
SQL>DECLARE
  2     Val   NUMBER;
  3  BEGIN
  4     SELECT SEQ_TEST.CURRVAL
  5       INTO Val
  6       FROM DUAL;
  7
  8     EXECUTE IMMEDIATE 'ALTER SEQUENCE SEQ_TEST INCREMENT BY ' || TO_CHAR(1 - Val);
  9
 10     SELECT SEQ_TEST.NEXTVAL
 11       INTO Val
 12       FROM DUAL;
 13
 14     EXECUTE IMMEDIATE 'ALTER SEQUENCE SEQ_TEST INCREMENT BY 1';
 15
 16     DBMS_OUTPUT.put_line('New value of SEQ_TEST is ' || TO_CHAR(Val));
 17  END;
 18  /
New value of SEQ_TEST is 1



CREATE OR REPLACE PROCEDURE do_job IS

BEGIN
       drop sequence Srno;
            create sequence SrNo
            minvalue 1
          maxvalue 9999999
          start with 1
          increment by 1
          Order;
               COMMIT;
END do_job;
Declare
v_job number;
begin
dbms_job_submit
(v_job,'do_job',
last_day(sysdate)+1,
to_char(trunc(last_day(sysdate)+1)+(6/24)));

hth, Urs

分享到:
评论

相关推荐

    RealThinClientSDK_v610_BETA

    and searching through the Help files didn't give you the answers you need, don't hesitate to post your question(s) on Developer Support groups. The latest Help file for Off-line viewing is in the ...

    Debbie Millman - How to Think Like a Great Graphic Designer.pdf

    “At the end of the day, I would pound them into oblivion and look forward to the next day when I could recreate the world.” 41 pau l a sch er “ I wanted to make wonderful things, things that ...

    wamp5 a development environment

    To install the package, you only have to run it and follow the instructions on the screen. Nothing more simple. Once installed you can add new versions of the resident applications. WAMP5 ...

    ICS delphixe10源码版

    picture postcard showing the area you live in and some beautiful stamps for my kids who are stamp collectors. Do not use an envelop, I collect USED postcards sent to me. Write on the postcard that it ...

    Kinect Hacks: Tips & Tools for Motion and Pattern Detection

    With this book, you get a step-by-step walkthrough of the best techniques and tools to come out of the OpenKinect project, the largest and most active Kinect hacking community. this book will give ...

    pcb guidelines

    In fact, a Fourier analysis can be used to find the amplitude and phase of each of the frequencies and determine how many are needed for reconstructing the pulses to the desired level of precision ...

    数位板压力测试

    In this document, the words "tablet" and "digitizer" are used interchange¬ably to mean all absolute point¬ing or digitizing devices that can be made to work with this interface. The definition is ...

    RemObjects SDK for Delphi

    For the server, you can modify the list of services supported on the right-hand side, while for the client you can enter a service name and get a list of the servers available on your LAN to support ...

    Pro iOS 5 Tools: Xcode Instruments and Build Tools

    How to deal with networking issues and reliably recreate or simulate these environments How to address multitasking, behind the scenes power drains, and reduce/optimize power usage from the radio and ...

    Color Correction Look Book

    Today's filmmakers often want to recreate the idiosyncrasies of older recording methods, or are looking for something completely new, to differentiate the look of a given project. Furthermore, end-to...

    Raspberry.Pi.Gaming.2nd.Edition

    After learning how to set up a Raspberry Pi, you will begin by creating your own version of Flappy Bird and a clone of the classic game Pong in the Scratch programming language. You will also be ...

    Raspberry Pi Gaming(PACKT,2ed,2015)

    This book teaches you how to hook up your Raspberry Pi computer, install different games from a variety of genres, and set up emulators so you can play hundreds of classic arcade and console games....

    Android Activity内嵌Fragment,当Activity recreate时Fragment被添加多次,造成界面重叠

    详情见博客:https://blog.csdn.net/qq_20785431/article/details/100519075

    How To Drop, Create And Recreate DB Control In A 10g Database [ID 278100.1]

    How To Drop, Create And Recreate DB Control In A 10g Database [ID 278100.1] Metalink上下载

    myBase Desktop 6.1.1 11/1/2012 绿色 完美破解版

    Fixed: Tries to recreate the tray icon in the case that Windows Explorer crashed; Fixed: The attachment keeps its original filenames when it's open within an external application; Fixed: Find-as-you-...

    Python库 | docker-recreate-1.4.1.tar.gz

    资源分类:Python库 所属语言:Python 资源全名:docker-recreate-1.4.1.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059

    svnplot 0.7.5

    IMPORTANT : Version 0.6.x users and 0.7.0 users, please upgrade to 0.7.4 and RECREATE the database. News/Updates NEW version 0.7.5 available (28 May 2011) Fixes critical bugs about wrong line count,...

    virtual-vulcano

    虚拟火山 在您的服务器上安装 ...文档 (西班牙语) 贡献 要求 您将需要文档指定的软件。 ...分叉并克隆 repo。... 建造集装箱:提供crane provision 如果要访问数据库,请运行 ...Redistribution and use in source and bi

    DevExpress VCL 13.1.4(v2013vol1.4) 源码-例子-帮助-part2

    Note that products, controls and libraries which aren't mentioned in the list below are included in the unified installer for compatibility, but have not been updated. Enhancements and Updates New ...

    DevExpress VCL 13.1.4(v2013vol1.4) 源码-例子-帮助-part1

    Note that products, controls and libraries which aren't mentioned in the list below are included in the unified installer for compatibility, but have not been updated. Enhancements and Updates New ...

Global site tag (gtag.js) - Google Analytics