Sequence nextval reset at every month with 1

I want to change Sequence Nextval = 1 at every month
I m using this sequence
create sequence VoucherNo
minvalue 1
maxvalue 9999999
start with 1
increment by 1
Order;i want then when start next month sequence nextval should be 1 .
reset with 1.

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 1hth, Urs

Similar Messages

  • Photo File Names Reset After Every Synch with iPhoto

    I have iPhone 3GS running iOS 4.0.1
    This only started happening in the last couple weeks: every time I synch-and-delete my photos with iPhoto (6.0.6), it resets the "file name" counter on the photos I take on the phone. I've been using this version of iPhoto and synch-and-delete as my photo saving method since I got the phone and before it would always remember the last photo number taken. Now I am ending up with dozens of photos in my library called "IMG_0001" etc, which is very frustrating when I want to move photos anywhere as a batch.
    Is this a new "feature" for iOS4? I can't find any settings that could be causing it on the phone.

    I noticed the same problem today when I tried to export my iphone pictures from iphoto into a folder with other iphone pictures from last week.
    I have an iphone 4 running 4.0.2

  • Sequence.nextval doubles the returned value with Execute Statement (F9)

    There appears to be a quirk with sequences in Raptor.
    Has anyone noticed that depending on how you execute this sql (SELECT MYSEQ.NEXTVAL FROM DUAL;) the value returned is either the correct nextval or double what you expected?
    For example, MYSEQ is a simple sequence which increments by 1. If you Execute Statement (F9) then the value returned jumps by 2 instead of 1. If you Run Script (F5) then the value returns jumps by 1, as expected.
    If MYSEQ is changed to increment by 2. The when you Execute Statement (F9) then the value returned jumps by 4 instead of 2. If you Run Script (F5) then the value returns jumps by 2, as expected. No matter what you put for the increment by Execute Statement (F9) always doubles it.
    It always seems to be double. Executing the same scenario in TOAD always returns the correct value (i.e. properly increments).
    Is the query being executed multiple times with Execute Statement? Why is this happening?

    While there is no guarantee from Oracle that sequences produce sequential numbers, this is obviously a case where SQL Developer is running the select statement twice.
    The issue is that queries can actually change information, rather than just retrieve data from the database.
    The following package is a test case:
    create or replace package test_query is
    function get_next_count return number;
    end;
    create or replace package body test_query is
    cnt number := 0;
    function get_next_count return number is
    begin
    cnt := cnt + 1;
    return cnt;
    end;
    end;
    select test_query.get_next_count from dual;
    This query, which should return 1, 2, 3, 4, etc actually returns 2, 4, 6, 8, etc, because SQL Developer is running the select twice.

  • Getting 1st of every month

    Hi all,
    Can anyone suggest me a logic for the following requriment.
    How to get 1st of every month with out using '-' operator?
    Thanks in advance
    Cheers
    Nirmal

    ...but don't forget to convert it back to a date, and to use 4 digit years:
    SQL> SELECT TO_DATE('01-'||TO_CHAR(sysdate,'MON-YYYY'),'DD-MON-YYYY') FROM DUAL;
    TO_DATE('
    01-JUN-06
    SQL> alter session set nls_date_format='dd/mm/yyyy';
    Session altered.
    SQL> SELECT TO_DATE('01-'||TO_CHAR(sysdate,'MON-YYYY'),'DD-MON-YYYY') FROM DUAL;
    TO_DATE('0
    01/06/2006Dates and strings are not equivalent and a date does not hold any display formatting information...it is only formatted when converted to a string either explicitly by using to_char, or implicitly using the nls settings
    HTH
    David

  • My data package reloads every month.  This month the counter in settings didn't reset.  whats wrong?

    My cell provider reloads my acccount with a fresh 4G every month.  The 5c used to track usage.  This month it did not reset.  Whats wrong?

    Sounds like a problem with your carrier. Contact your carrier to find out why your data level was not updated.

  • Acmcneill1ug 14, 2014 7:16 AM I have IMac OSX 10.9.4, 4GB,Processor 3.06 with Intell2Duo. I would like to check for Malware. I run a TechTool Pro 6 every month and that comes up great. When check how much memory I am using, with only Safar

    Acmcneill1ug 14, 2014 7:16 AM
    I have IMac OSX 10.9.4, 4GB,Processor 3.06 with Intell2Duo. I would like to check for Malware. I run a TechTool Pro 6 every month and that comes up great.
    When check how much memory I am using, with only Safari open I am using 3.9 and more of her 4.0 memory. She is very. very slow in processing. I had 4000
    trash to clean out and it took her over an hour to expel. Also for some reason Safari will not allow me to click on a link, in my G-mail, and let it go to the page.
    It has a sign saying a pop-up blocker is on and will not let me do it. I must open the stamp to look at my e-mails and if I have redirected link now I can do it.
    I have not changed my preferences so where is this pop-up blocker?
    I have looked at preferences on Safari and Google, which I do not understand Google, and do not see where this blocker could be.
    Malware is something I want to make sure is not on my computer. Tech Tool Pro 6 is all I know of and it does not detect Malware.
    Help.
    Ceil

    Try Thomas Reed's Adware removal tool. He posts extensively in the communities.
    Malware Guide - Adware
    Malware Discussion

  • How do I have a totalizer reset at the end of every month?

    We are using Lookout 5.1 in an application that is receiving a Modbus input giving us a totalizer value.  We need to have this value reset to zero at the end of every month.  Also want the monthly total to be sent to an excell spread sheet.  All help is much appreciated.

    I think this NI Post will help you out....
    Regards

  • My Adobe Acrobat X pro is not opening after 1 month of Installing, it happens every month then I re-install to use it with my Serial Number again

    My Adobe Acrobat X pro is not opening after 1 month of Installing, it happens every month then I re-install to use it with my Serial Number again

    Hi hnssiva,
    The answers to Pat's questions will help us get to the bottom of things. In the meantime, please check out this document: http://helpx.adobe.com/creative-suite/kb/acrobat-failed-launch-30-days.html, as it sounds like you may be running into the issue it covers.
    Best,
    Sara

  • Cannot connect to Net, have done for last 12 months no problem, I have other apple products that are connecting to the same hub happily. The hub is seen and the signal is strong, it just doesn't connect. I have reset the network settings with no joy.

    cannot connect to Net, have done for last 12 months no problem, I have other apple products that are connecting to the same hub happily. The hub is seen and the signal is strong, it just doesn't connect. I have reset the network settings with no joy. Any help much appreciated?

    Try restarting your WiFi router by removing power to it for 30 seconds.

  • We have 'CS6' version of Adobe. We are facing a problem with 'Acrobat Pro'. Every month that is stop working and everytime need to install. Kindly help us regarding solving this problem...

    We have 'CS6' version of Adobe. We are facing a problem with 'Acrobat Pro'. Every month that is stop working and everytime need to install. Kindly help us regarding solving this problem...

    Your Acrobat is running in Trial Mode.  Try this KB: Creative Cloud applications unexpectedly revert to trial mode | CS6, CCM
    If it doesn't work you need to contact Adobe Support for assistance.

  • Not able to acess app store .. Tried every thing with ... Dns change .. Time chage.... Reset... Location services .suggest me how to resolve this issue

    Not able to acess app store .. Tried every thing with ... Dns change .. Time chage.... Reset... Location services .suggest me how to resolve this issue

    Hi aditya123,
    If you are having difficulty connecting to the App store from your iPhone, you may want to try the steps in this article -
    Can't connect to the iTunes Store
    http://support.apple.com/kb/TS1368
    Specifically -
    Troubleshoot issues on an iPhone, iPad, or iPod touch
    If you haven't been able to connect to the iTunes Store:
    Make sure your date, time, and time zone are correct in Settings > General > Date & Time.
    Note: Time Zone may list another city in your time zone.
    Make sure that your iOS software is up to date by tapping Settings > General > Software Update (iOS 5 or later) or connecting your iOS device to iTunes and clicking Check for Update on your device's Summary page.
    Check and verify that you're in range of a Wi-Fi router or base station. If you're on a device with cellular service, make sure that cellular data is turned on from Settings > General > Cellular.
    Note: If connected to cellular data, larger items may not download. You may need to connect to Wi-Fi to download apps, videos, and podcasts.
    Make sure that you have an active Internet connection. You can check the user guide for your device for help with connecting to the Internet.
    Make sure that other devices (portable computers, for example) are able to connect to the Wi-Fi network and access the Internet.
    Try resetting (turning off and then on again) your Wi-Fi router.
    If the issue persists, try troubleshooting your Wi-Fi networks and connections.
    It looks like you have already done many of these, but there are a few more to check out.
    Thanks for using Apple Support Communities.
    Best,
    Brett L

  • I paid on time every month even with horrific service. When will I get my card?

    I paid on time every month even with horrific service. When will I get my card?Michelle R. Rockwell12055 E. Harvard ave. #202Aurora, C.O 80014

    If your son actually ordered and paid for it in-store then he was given a ship date that it would either be arriving for in-store pick-up or a beginning date that it would be shipped to your house ( Jan 10th - Jan 18th )  etc.  Since it was paid for upfront the only thing that would stop you getting it would be if Toshiba stopped producing it and Best Buy totally ran out at all its stores - otherwise Best Buy will do its best to fullfill your order.  You can usually talk to someone directly by calling the store and they can check the status of your order for you.   Hope this helps a little.

  • Hello, I have problems with iCloud. I do not recognize the password and can neither a reset occurs every time I want to do something to stick to iCloud password but does not recognize, what to do? thank you

    Hello, I have problems with iCloud. I do not recognize the password and can neither a reset occurs every time I want to do something to stick to iCloud password but does not recognize, what to do? thank you

    Stop multiple posting

  • Pay with invoice instead of credit card every month?

    I work for a company that wishes that my Adobe Creative Cloud subscription payable by invoice instead of credit card every month, how do I fix this?
    / John

    Hi Matisson,
    I would request you to go through the payment structure of Adobe Creative Cloud & choose the best option for you.
    Please go through this:
    1.http://helpx.adobe.com/x-productkb/policy-pricing/membership-subscription-troubleshooting- creative-cloud.html
    2.http://helpx.adobe.com/x-productkb/policy-pricing/print-creative-cloud-receipt.html
    Hope it helps you.
    Regards,
    Rajshree

  • DSL down EVERY month for over a year!

    This is both sad and ridiculous that I've have had my DSL internet go down pretty much every month for over a year now and I can never ever get a reason, requested call back or decent credit/discount for all my pain, suffering, time and heartache this has caused me!
    Finally after over a year of calling and verizon telling me EVERTIME that my line is coming up with an issue did I get an agent who finally listened to me that it's every month and said "I'm going to fix this for good!" He told me that he was going to authorize my line be changed over or something- said its costly to Verizon but since its documented that there really is outages every month from my line he will do it he also gave me 800 number said when all was said and done I could call and receive credits for my constant issues! Said my internet would be down few hours while this was being done but he would call me as soon as it was done on Monday he "promised" well this was end of June 2015, maybe 22nd anyway morning came and like he said no internet and got text that Verizon was coming, ok no idea what time it went down but I got up at like 8 am and it was down well now it's like 2pm and still down and never once did I see a Verizon truck nor did I get any call - I call 800 # told my line is still showing being worked on but he would call and check what was going on... Comes back said they are still working on it but they said you can reboot your router/modem. "Would you like me to assist with that?" I say yes and he gets me back on and says I will get a call as soon as everything is all set with my line, he confirms both my phone numbers and I thank him. I go to work and still hear nothing so at around 10pm I call Verizon and get someone from India saying my line is still being worked on and that I would receive a call when fixed. We hang up and I call the 800 number I was given for my credit, agent was nice but said if line is being worked on still I can't get any credits until work is completed well I get a beep on my phone and ask agent if she could hold on I think Verizon was calling me back... It was the agent from India saying he now sees my work is completed (at like 10:30 pm) so I thank him go back to agent from America and tell her so she says "let me check again" comes back says I'm sorry I'm showing on my end still down and says I should call back tomorrow to get my discount. I call back next morning and I was told that she didn't see any work done on my line that agent talked me through router/modem reset and fixed issue! I was like NOOOO! She said she would make some more calls because she read the notes and said I was right this makes no sense.... She said unfortunately I couldn't get a straight answer but I'll take money off for your inconvenience! Ok now it's almost 3 weeks later and my internet is completely down!!!! I call and I'm told "I see your internet is going down on a pretty regular basis let me call a level 2 tech stand by"he comes back says I'm in luck tech said they are going to reroute my lines! I was like WOOOOO I was told 3 weeks ago that was done and that I want to be connected to that tech or tech manager or supervisor and he tells me he can't connect me but assures me they will call me back.... Nothing... Today I get a text saying my issue will be fixed by Wednesday Juky 15th ... Still no call so around 2pm I call get agent who just keeps saying my issue will be resolved by Wednesday I tell her I want tech supervisor to call me! She says that she can't but assures me once issue is corrected Wednesday a tech supervisor will call me! I said no you guys always say that and that I want a tech supervisor... She tells me she put in a remark and that a tech supervisor will call me...
    HOW DO I GET A STRAIGHT ANSWER FROM YOU GUYS? I have pretty much every service you provide in my area! Home phone, DSL, directv through you, personal cell phone, work phone! Not counting my work phone I'm paying over $320 a month and I'm always on time and been a loyal customer for so many years that I now lost count and you have made my family's internet experience a living nightmare not to mention that every time my internet goes down it screws up my surveillance cameras go down and the camera guy now charges me a fee to come down and get them going on my network because it's so frequent and keeps telling me to go Comcast! I'm going broke staying with Verizon and I WANT someone to call me and explain what's going on and take ownership and comp me for all the time I wasted! All this and Verizon wireless won't even throw me a few more gigs a month on my service since I have to use my wireless cell gb's due to my verizon DSL being down and not being able to get online any other way!

    Your issue has been escalated to a Verizon agent. Before the agent can begin assisting you, they will need to collect further information from you.
    Please go to your profile page for the forum, and look in the middle, right at the top where you will find an area titled "My Support Cases". You can reach your profile page by clicking on your name beside your post, or at the top left of this page underneath the title of the board.
    Under “My Support Cases” you will find a link to the private board where you and the agent may exchange information. This should be checked on a frequent basis as the agent may be waiting for information from you before they can proceed with any actions.
    To ensure you know when they have responded to you, at the top of your support case there is a drop down menu for support case options. Open that and choose "subscribe".
    Please keep all correspondence regarding your issue in the private support portal.

Maybe you are looking for