How to use the new sequence when it is reached its maxvalue in PL SQL code

Hello

Currently, I am the filling of a number of unique product in a table column by using a call sequence to generate the new number. For different products, I have different sequences and in my PL SQL code usiing IF... Else block I fill the serial number for different products. For a sequence more selling product, we reach a Max value in the production in one month and ensure that the application continues to run properly for the different end-users without getting any error on their screens, I want my code to automatically switch to the new sequence. I just need to add another if condition but my problem is how to find precisely when the maximum value is reached in old sequence.

As the call to the old sequence can occur in different sessions he could be inconsistency and can be found in the error. My new sequence value must begin with AV1000. Please suggest.

My old sequence look like this:
SEQUENCE of Prd
INCREMENT BY 1
START BY AS1000
MAXVALUE AS9999
MINVALUE AS1000
NOCYCLE CYCLE
CACHE 2
Order Yes;

Published by: user11695088 on July 15, 2009 12:14 AM

Catch the exception and use your new sequence. But somehow, I'm not like your alternative approach.

SQL> set line 300
SQL> set pages 50000
SQL> set serveroutput on
SQL> create sequence testing_seq increment by 1 start with 1 maxvalue 3
  2  /

Sequence created.

SQL>
SQL> create or replace procedure test_seq_proc(p_seq out number)
  2  is
  3  begin
  4     select testing_seq.nextval
  5     into p_seq
  6     from dual;
  7  --
  8     dbms_output.put_line(p_seq);
  9  --
 10  end;
 11  /

Procedure created.

SQL> declare v_out number;
  2  begin
  3     test_seq_proc(v_out);
  4  end;
  5  /
1

PL/SQL procedure successfully completed.

SQL> /
2

PL/SQL procedure successfully completed.

SQL> /
3

PL/SQL procedure successfully completed.

SQL> /
declare v_out number;
*
ERROR at line 1:
ORA-08004: sequence TESTING_SEQ.NEXTVAL exceeds MAXVALUE and cannot be instantiated
ORA-06512: at "ETL_ADMIN.TEST_SEQ_PROC", line 4
ORA-06512: at line 3

SQL>

See you soon
Sarma.

Tags: Database

Similar Questions

  • How to use the NEW BLACK xbox 360 media center remote with Windows 7 Ultimate & Windows Media Center

    I have the new Black xbox 360 media center remote and I can not understand how to use it with my PC to run windows media center. I'm running Windows 7 Ultimate x 64, and I also have the receiver wireless for my xbox 360 wireless controllers.

    Here is a link to a better image of the remote control.
    Here is a link to my xbox 360 wireless receiver.
    I also have a mini receiver RF for a keyboard and a mouse if that helps somehow.
    I don't have an xbox 360, but I like to use my controller wireless for my PC games and emulators like the style and color of this remote it would go well with my current setup as well as with XBMC.
    If anyone knows or can help me to find a way to make this work I would appreciate it a lot.
    Thank you
         
    Michael

    Hi Michael,

    Thanks for posting your question in the Microsoft Community.

    The question you have posted is related to the Xbox 360 and it would be better suited to contact Xbox support to obtain assistance from the links below:

    Contact XBox Support:

    http://support.Xbox.com/en-us/contact-us

    http://support.Xbox.com/en-us/browse?product=Xbox-360

    I hope that the information above helps you.

  • How to use the new subfolder feature Web App?

    How do we use this new feature, can provide you steps in the process?

    BC Blog Web App update subfolder:

    suggested http://www.BusinessCatalyst.com/_blog/BC_Blog/post/January_2013_System_Update_-_Fresh_UI_i, _Web_App_enhancements_and_more.

    "Make elements of the Web App inside a subfolder, for example/folder/subfolder/webapp-name." For example, you might have/blog/authors/bogdan (where Bogdan is the name of the Web-App element)"

    Just like it says really.

    You can create a folder with the same name as your web application and create pages inside.

    Web application called - news.

    File - other

    Create the index page - /news/index.html

    This means / news will go to that landing page and web elements app works as usual as - / news/your-news-post

    You can create other pages in this folder if you want, but may not be the same name as your web application parts.

  • How to use the current connection when the db procedure call?

    Hi all

    Use Jdevleoper 11.1.1.3.

    I have a java class that calls a database procedure, now everything is fine with me, but a little slow because am open a new connection, I think it would be certainly faster if the current connection is using
    so, how can I re - write my code so I can use the istead of connection today to define a new connection to the DB:

    public void DeleteApp (int PAppNo) {}
    String username, password, thinConn;
    username = "ACC";
    password = "ACC";
    thinConn = "JDBC: thin: @...» »
    try {}
    DriverManager.registerDriver new (OracleDriver());
    Connection Conn = DriverManager.getConnection (thinConn, username, password);
    CallableStatement cs = conn.prepareCall ("{call myprocedure(?,?,?)}");
    cs.setInt(1,PAppNo);
    ....
    }

    Thanks for all,
    MaLa

    I would like here...

    A big problem, it's that you must hard code connection information into the user interface. No change to a different DB server configure it without changing the code and redeployed.

    Next, why don't you put method in the module of the application and call it? This will keep the valid MVC pattern.

    Timo

  • How to use the new features of Oracle BAM?

    Hi, I read that JDeveloper 11.1.1.2.0 introduced counters, intervals and Indcators business from the perspective of the monitor.

    But I can't find the way to display this information in Oracle BAM like I do with sensors. Someone can explain to me how to use it or let me know if there is a documentation on this subject?

    Thanks in advance.

    In addition, you will need to go into the perspective of monitor in the BPEL view and then you can see all the artifacts - interval, meter, indicator of business and the sensors in this point of view. Select lower down on the top right in view BPEL to change perspective.

    In addition, installation under SOA_HOME/bam/samples/bam - BAM, there a folder called monitorexpress. Navigate to the directory "/ bin" and run the configure script to load the datamodel and dashboards.

    Configure the BAM adapter in the SOA server to make sure that the Monitor objects will receive data from BPEL
    THX
    Poyard

  • How to invoke the export and import of orders for all tables of pl/sql code?

    I want to export a few (not entire schema) tables from one database to another. But I want to run as a PL/SQL package so that I can call it from an application server. So my question is...

    How to call a tax / export commands from pl/sql code (SP or packaging) so that I can call these (SP or packaging) as a JDBC application server call?

    Krishna_Architect wrote:

    I want to export a few (not entire schema) tables from one database to another. But I want to run as a PL/SQL package so that I can call it from an application server. So my question is...

    How to call a tax / export commands from pl/sql code (SP or packaging) so that I can call these (SP or packaging) as a JDBC application server call?

    When all else fails, read the Fine

    The API data pump

  • May not know how to use the new version of "DC" Adobe [Android]

    I have the Samsung S 10. I had a simple version of Acrobat Reader and was invited to update the access point to this version of DC. Since then, I can't go directly to my files, I can't move my FlashDrive to my files documents.

    Unfortunately, you won't be able to move files in different folders with the latest version of Acrobat DC. However, you can access your documents directly in the tab "Local". It lists all the PDF files available on your device. Sorry for the inconvenience.

    Thank you

    Acrobat DC Team

  • With no headphone jack, how to use the iPhone in my car 7

    Okay, so here's the challenge.  I have a power source and a headphone and not Bluetooth.  It works perfectly with iPhones before 7.  But with 7, it isn't possible to use the same configuration I had for years.  I own my car, and I have no interest in buying a new car just to support a new phone.  And since this will be a problem for the years to come if I stay with Apple, I would like to know what are the solutions are available.

    So, how to use the new iPhone 7 while remaining responsible and using my car speakers?  Dongles Bluetooth that I need to reload, it's probably not.

    Thus, looking for ideas that might have people.  I can't be the only one with this concern.

    It's almost a certainty that a third party adapter will appear quickly. The new Macbook has a single port usb - c and people asked the same question, 'how to load and use USB at the same time." There are today dozens of solutions for the Macbook, and then it will be with the iPhone 7. An adapter with a 3.5 mm jack and a port of loading Lightening would be my guess. Kickstarter entrepreneurs are probably already working on it.

  • How to use the OEM grid control to find databases, not in archivelog mode?

    Hello

    We have currently 130 databases, say, if I want to come off as any database currently NOT in archivelog mode, is there a quick way to find out?

    using the OEM grid control

    or

    a similar trick,

    but really do not need to manually check each database.

    Thank you very much!

    This query works in 12 c - please run as SYSMAN.
    It is based on undocumented assumptions well + (AND key_value = "NOARCHIVELOG") +.

      SELECT *
      FROM SYSMAN.MGMT$GROUP_DERIVED_MEMBERSHIPS O ,
        SYSMAN.MGMT$TARGET T ,
        sysman.MGMT$AVAILABILITY_CURRENT st
      WHERE
      o.member_target_type     IN ('oracle_database', 'rac_database')
      AND ( t.target_type           ='rac_database'
      OR (t.target_type             ='oracle_database'
      AND t.type_qualifier3        != 'RACINST'))
      AND o. member_target_guid     = t.target_guid
      AND t.target_guid             = st.target_guid
      AND st.availability_status    = 'Target Up'
      AND ( EXISTS
        (SELECT *
        FROM sysman.mgmt$metric_current i
        WHERE I.TARGET_GUID = O.MEMBER_TARGET_GUID
        AND metric_name     = 'archFull'
        AND Metric_Column   = 'archTotal'
        AND metric_label    = 'Archive Area'
        AND column_label    = 'Total Archive Area (KB)'
        AND key_value       = 'NOARCHIVELOG'
        ));
    

    Another way to achieve the goal is to push the extended parameters (SELECT LOG_MODE FROM V$ DATABASE) on each DB and monitor the values they return to the repository. This is an example for a (slightly) different problem - http://iiotzov.wordpress.com/2012/08/08/how-to-use-the-new-oem-12c-metric-extensions-to-enforce-enterprise-wide-custom-policies.

    OEM repository has many other uses grand-http://iiotzov.files.wordpress.com/2012/05/oem-repository-a-second-look.doc, http://iiotzov.files.wordpress.com/2011/08/iotzov_oem_repository.pdf

    Lordane Iotzov
    http://iiotzov.WordPress.com/

  • When you use the new button tab is open a new tab, with a search engine that I don't want. How to change this to make it possibly open my home page?

    When I use the new button tab in the tab tool bar, it opens the Yahoo! search engine. I would like to change it to open my home page, or a search engine different. Is it possible to do it and how?

    Thanks for any help!

    I think that is changed by an extension. If you run Firefox in Mode safe search engine comes up when you open a new tab? http://support.Mozilla.com/en-us/KB/safe+mode

  • How to get the new activation key when some numbers are taken away and you have received?

    How to get the new activation key when some numbers are taken away and you have received?

    Have a laptop with windows 7 from Dell. Need to re install W7. And I have some numbers are taken as a result of its use.
    How can I get a new code activation or my complete activation code?
    Best regards, W7 user

    How to get the new activation key when some numbers are taken away and you have received?


    Have a laptop with windows 7 from Dell. Need to re install W7. And I have some numbers are taken as a result of its use.
    How can I get a new code activation or my complete activation code?

    Dell provided you with restore/recovery media and/or a way to restore the machine 'default' as a key sequence?  If so - you won't need the number--unless they just sent a DVD of Windows 7 nu - and they are usually not unless you ask.

    They have probably installed using their key, which means that even with a utility like Belarc Advisor or ProduKey - you will not get the product key that matches the one on the sticker.

    Some may have you take several different digital pictures of the sticker from different angles and see if you can decipher the missing characters like that (you'd be surprised to see how that works).

  • HOW TO STOP THE NEW ADS ON FACEBOOK... THEY ARE FRIGGIN BORING AND REEK HAVOC WHEN YOU PLAY... PLEASE ME TELL HOW TO BLOCK THEM!

    How to stop the new ads on Facebook

    I get very annoyed by ads to where they are on the web so I use an add-on called 'Adblock Plus' which uses its database to block known ads and you can even block yourself!

    With 'Adblock Plus Adblock Plus ' installed, you can block all advertising photo:

    1. right click on the announcement of photo that you want to get rid

    2. in the menu, click the option that says: ' Adblock Plus: block image... "(it is usually at the bottom of the menu)

    3. when the pop up box appears, simply click 'Add filter' and advertising will disappear before your eyes!

    If this was the answer you are looking for, please click 'Resolved' - thank you.

  • When you use the pen tool when I click and create an anchor point and release the mouse button the pen tool emerges from the anchor and allow me to go and select a new anchor point. The right pen tool keeps adding lines that I move the mouse.

    When you use the pen tool when I click and create an anchor point and release the mouse button the pen tool emerges from the anchor and allow me to go and select a new anchor point. The right pen tool keeps adding lines that I move the mouse.  How can I get the pen tool to release the anchor

    Try this.go in the menus. Select cc illustrator > preferences > display selection & anchor > then make sure the box "activate the rubber band for" the pen tool is not selected. Then press OK. It should work.

  • How will I know if I use the new synchronization?

    Want to know if I need to go through the new process of synchronization of devices not linking the synchronization of the former and the reset to the new synchronization.

    The servers used for the old version of sync have been taken down and you can no longer access the data stored on the server.
    You can use the new synchronization version that uses a Firefox account (https://accounts.firefox.com/).

  • My gmail and Icloud accounts disappear from the list under "Mailbox store" in the mail. When I try to recreate my gmail account using the "new mailbox...» "I get the message"this account already exists. " What can I do to recover my mailboxes.

    I use YOSEMITE 10.10.5.

    My gmail and Icloud mailboxes (and several smart mailboxes) disappear from the list under "Mailbox store" in the mail. When I try to recreate my gmail account using the "new mailbox...» "(using the sign on the side down and to the left of the screen in Mail +) I get the message"this mailbox already exists. ». What can I do to recover my mailbox?

    Restart the Mac and Mail.

Maybe you are looking for

  • bookmark appears twice

    I have a new computer (MS Windows 7). I imported my favorites, but I think that I imported both times. How can I get rid of the second sect without clear everything and start over.

  • base handling integer does not not on HP first Calc?

    I am a new user of the first HP Calculator.  Suite page 585 of the manual on the manipulations of integer.  I've entered a number #100001100 b and to display its value in hexadecimal form or decimation.  I scroll to the top to select.  Then I press t

  • Plugins installed disappear when I restart my computer

    I am running Firefox 3.6.13. I had a file corruption problem and had to reformat the image of the factory and then reinstall all my software. I used mozbackup firefox backup settings. I have restored and he handed my favorites and passwords very well

  • HP 15 15-f010wm notebook: HP 15 laptop BIOS pass reset?

    Have HP-15f010wn with bios forgotten past to: 70052673 after 3 failed attempts. Hard drive went bad and can not select start.  I removed the battery ram and room. ? Any response is thanked! AB

  • How to know ULTIMATE HORIPAD game wireless controller have full powers?

    How to know ULTIMATE HORIPAD game wireless controller have full powers? It works very well, the only thing is, I have 3 hours of charging with the USB lighting power cable, the cable is working fine, but the led on the controller always alone on (the