code to run a process for a range of dates, ignoring Sundays and holidays

I have a proc by name (P_NAME, P_BIZDATE) INS_INVENTORY (P_NAME IS OF TYPE VARCHAR2, P_BIZDATE IS PRESENT). Actuallythis proc runs every day in our Planner. I had to make changes to this procedure. Now, I need to run this proc for P_BIZDATE taking the dates of 1 January 09 to 31 December 09. We also have a table by its PT_HOLIDAYS name, which consists of the list of holidays from 1 January 2009 to 31 December 2009. Now I need a code or a process through which I can run this proc 1 January 09 to 31 December 09 and also this proc should not be run 'SUNDAY' and public holidays as specified in the PT_HOLIDAYS table

CREATE TABLE PT_HOLIDAYS
(
HOLIDAY_DATE DATE NOT NULL,
DISPLAY_NAME VARCHAR2 (35 BYTE) NOT NULL,
)

Insert into PT_HOLIDAYS
(HOLIDAY_DATE, DISPLAY_NAME)
Values
(TO_DATE (1 January 2009 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), "New Year Day");
Insert into PT_HOLIDAYS
(HOLIDAY_DATE, DISPLAY_NAME)
Values
(TO_DATE (25 May 2009 00:00:00 "," MM/DD/YYYY HH24:MI:SS'), "Memorial Day");
Insert into PT_HOLIDAYS
(HOLIDAY_DATE, DISPLAY_NAME)
Values
(TO_DATE (4 July 2009 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'July 4');
Insert into PT_HOLIDAYS
(HOLIDAY_DATE, DISPLAY_NAME)
Values
(TO_DATE (7 September 2009 00:00:00 "," MM/DD/YYYY HH24:MI:SS'), 'Labor Day');
Insert into PT_HOLIDAYS
(HOLIDAY_DATE, DISPLAY_NAME)
Values
(TO_DATE (26 November 2009 00:00:00 ',' DD/MM/YYYY HH24:MI:SS'), 'Thanks Giving Day');
Insert into PT_HOLIDAYS
(HOLIDAY_DATE, DISPLAY_NAME)
Values
(TO_DATE (26 December 2009 00:00:00 "," MM/DD/YYYY HH24:MI:SS'), 'Christmas');
COMMIT;


Please advice

Like this?

declare
start_date date := to_date('01/01/2009','MM/DD/YYYY');
end_date date :=to_date('12/31/2009','MM/DD/YYYY');
cur_date date;
total_run number := (end_date - start_date)+1;
holiday number := 0;
begin
for i in 1..total_run loop
     cur_date := start_date + (i-1);
          begin
               select 1 into holiday from PT_HOLIDAYS where HOLIDAY_DATE = cur_date;
          exception
               when no_data_found then
               holiday:=0;
          end;
     if to_char(cur_date,'DY') != 'SUN' and holiday != 1 then
          dbms_output.put_line(cur_date||'-'||to_char(cur_date,'DY'));
          --INS_INVENTORY( , cur_date)
     end if;
     end loop;
end;
/

Kind regards
Prazy

Published by: Prazy on March 29, 2010 12:39

Tags: Database

Similar Questions

  • Generic host process for win32 services has encountered a problem and cannot update windows

    Whenever I start my computer, I get this error message "generic host process for win32 services has encountered a problem and needs to close." The details of this problem are:

    (szappname:svchost.exe), (szappver:5.1.2600.5512), (szmodver: 0.0.0.0), (offset: 001 has 6240), (szmodname: unknown)

    c:/DOCUME~1/owner/locals~1/temp/wer94ea.dir00/Svchost.exe.mdmp

    c:/DOCUME~1/owner/locals~1/temp/wer94ea.dir00/appcombat.txt

    I also send an error report whenever this happens.

    The computer is running XP, but lately some settings have been changed such that the display is windows classic instead of XP.

    In addition, I can't run Windows Update completely. It freezes / hangs up in the middle of the update. I have also no audio.

    Please help, I ran SuperAntispyware, Spybot, and Avira. I'm lost!

    Reinstalling the operating system is unable to solve your problem. There is no need to do this if the problem is not related to the operating system and you find that you are back where you started.

    You gave us a general indication of the nature of the problem but the specific error reports are a much easier solution.

    When a BSOD (Blue Screen of Death) the system failure occurs, for most users, there not enough time to fully record what he says. the exact text is important for anyone trying to diagnose what is wrong. You can save time when the error occurs then by following the procedure described below.

    If you already did it disable the auto reboot system error. This should help by allowing the time to write the code to Stop error and related information correctly. Do right click on the icon my computer on the desktop and select Properties, advanced, startup and recovery, system failure and uncheck the box before automatically restarting. Re-do not enable automatic restart in the event of system failure after obtaining this information, this setting is the best left to not allow an automatic restart.

    If the failure occurs during the initialization of the computer, you need to try a different approach. You can access the Advanced Options Menu of Windows on multiple computers by constantly pressing the F8 (key) key when starting and selecting the option - disable automatic restart in case of system error. This method is not always easy to use because it may be difficult to press the F8 key at the right time. Try again if it doesn't work the first time. On some computers, a different key must be used.

    Take a look in the system and Application logs in the errors and warnings event viewer and post here the copies. Do not post on that more than 48 hours ago.

    You can access event viewer by selecting Start, Control Panel, administrative tools, and Event Viewer. When searching for the meaning of the error, information about the event ID, Source and Description are important.

    A tip for posting copies of error reports! Run Event Viewer and double-click the error you want to copy. You will see a button resembling two pages. Click on the button and close Event Viewer. This places a copy of the report to your Clipboard. Paste it into the body of your message. Make sure that it is the first dough right out of the event viewer.

    Hope this helps, Gerry Cornell

  • I get the error "Generic host process for Win32 services has encountered a problem and needs to close."

    Original title: I'm under Win XP Pro 64-bit with an amd processor.

    Hi all

    I get "Generic host process for Win32 services has encountered a problem and needs to close" when I first start the computer, the sound works, but after the old generic host appears the sound does not work?  Don't forget that I'm running 64-bit software.

    The search does not work.

    Any help would be great.

    Hi bohawk,

    I got to hit this article the error that you are experiencing with your computer. Refer to the same thing, check if the patch is useful.

    I hope this helps. If this isn't the case, answer so we can look for other options.

  • "Generic Host Process for Win32 Services has encountered a problem and needs to close." We are sorry for the inconvenience "_".

    After that I connect Internet in 10 minutes and 2 hours sometimes this messega Popes until one disconnects me Internet... I have dial up so when I try to reconnect it says does not detect a modem or a virus protection... then to start my computer acting funny i have to restart. What can I do to fix this?

    Hello

    We recommend that you reinstall the network adapter driver and check if the problem persists. To do this, visit the site of the manufacturer of the system or the network card and download the driver compatible Windows XP and then install on the computer.

    If the problem persists, try the following steps:
    Step 1: Check if a system file is corrupt
    a. Click Start, click Run, type cmd and click ok.
    b. at the command prompt, type sfc/scannow and press ENTER.

    Note: You will be asked to insert the Windows XP disk, if a file is missing.

    For more information, see Description of Windows XP System File Checker (Sfc.exe)

    Step 2: If the problem persists, restore the computer
    see How to restore Windows XP to a previous state .
    b. check if the problem persists.

    Also check if one of the following articles will help you in fixing the issue.
    1 displays generic host process Error Message and a flashlight icon
    2 see Generic Host Process for Win32 Services has encountered a problem and needs to close.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Please help: System freezes with error message "generic host process for win32 services has encountered an error and needs to close."

    Please can anyone offer help - whenever I start my PC it freezes
    then displays an error message "generic host process for win32 services has.
    encountered an error and needs to close. »

    In this error message, I get more information:

    szAppName: svchost.exe szAppVer: 5.1.2600.2180 szModName: ntdll.dll
    szModVer: 5.1.2600.2180 offset: 000122ba

    more information:

    C:\DOCUME~1\Joe\LOCALS~1\Temp\WERd9dd.dir00\svchost.exe.mdmp
    C:\DOCUME~1\Joe\LOCALS~1\Temp\WERd9dd.dir00\appcompat.txt

    I tried a lot of things: update drivers, run Ccleaner to check the registry,.
    checked for malware, Virus, uninstall xp service pack 3... Is there
    anything else I can try?

    After I clicked through the error messages above appears the taskbar
    Crash, then reappears, but with graphic reduction (gray color)

    I checked "Event Viewer" in "control panel" from here I get
    the following error message:

    Failed application svchost.exe, version 5.1.2600.2180, failed module
    ntdll.dll, version 5.1.2600.2180, fault 0x000122ba address.

    0000: 41 70 70 6 c 69 63 61 74 Applicat
    0008: 69 6th 6f 20 46 61 69 6 c ion Fail
    0010: 75 72 65 20 20 73 76 63 ure svc
    0018: 68 6f 73 74 2nd 65 78 65 host.exe
    0020: 20 35 2 2 31 32 36 30 5.1.260
    0028: 30 2 32 31 38 30 20 69 0.2180 I
    0030: 6th 6f 20 74 64 6 c 6 c 2nd n ntdll.
    0038: 64 6 c 6 c 20 35 2e 31 2nd dll 5.1.
    0040: 32 36 30 30 2 32 31 38 2600.218
    0048: 30 20 61 74 6f 20 66 66 0-off
    0050: 73 65 74 20 30 30 30 31 the value 0001
    0058: 32 32 62 61 22ba

    also an another error at the time of the accident

    0000: 42 75 63 6 b 65 74 3 has 20 bucket:
    0008: 31 32 39 36 37 35 38 33 12967583
    0010: 36 0D 0 to 6...

    Fault 129675836 bucket.

    I am extremely grateful for any help, this problem is about to drive me
    crazy!

    I solved my problem...

    To temporarily disable closing kick, after that the warning popup will appear, I went the prompt commands and typed in 'shutdown-a' so I could help out.

    Then I went in under the Application Event Viewer and saw that some services weird I don't need anyway did not start because they had missing information/dll registry info.  It was originally the svchost.exe service to fail (and default recovery for this is to reboot)

    I stopped the weird service (in this case, it was Hello) because I didn't need anyway, and went into the properties of this service and past earlier in "Manual" "automatic".

    Good luck

  • How to fix this error "generic host process for win32 services has encountered a problem and needs to close ' help me please I am using windows xp with SP3

    How to fix this error "generic host process for win32 services has encountered a problem and needs to close ' help me please I am using windows xp with SP3.

    When I close this error or click on send or do not send, my session network remote also network mapped drive United Nations accessible then I restart my computer and I can access my network grows but after awhile once again this error and the same network behavior that I discussed earlier.
    someone has a better solution that take care of this problem.

    Hello

    Given that the problem is related to the server of the IRIS, IRIS Contact support for assistance:

    http://www.IRISLink.com/C2-1967-189/I-R-I-S---technical-support.aspx

    Hope the above information is helpful.

  • Message saying that the Generic Host Process for Win32 Services has had a problem and will end. Then I have no sound more until I reboot

    I have a hp Pavilion working with XP but recently I installed Windows Office 2007. Since then, I have problems with the sound system. I got a message saying that the Generic Host Process for Win32 Services has had a problem and will end. Then I have no more sound. I can't open the volume control as the system says that nothing is installed. I always need to restart my computer to get the sound working again. Help!

    Thank you, Jerry. I'll try it, but for now it works well. I fit it and it seems to have done the trick.

    See you soon,.
    Karine

  • Generic Host Process for Win32 Services has encountered an error and needs close.__Unable to access windows update through the site or automatic updates.

    Hi, I really need help.

    My computer has been giving me problems recently.

    I get a random error message: Generic Host Process for Win32 Services has encountered an error and needs to close.

    My taskbar would turn gray and I cannot control the volume.

    I checked the event viewer, and this is what has been shown:

    Failing application svchost.exe, version 5.1.2600.5512, failed module ntdll.dll, version 5.1.2600.5755, address failure 0 x 00023845.

    %

    Hi E_G_G_S,

    1. did you of recent changes on the computer?

    2. when the taskbar turns gray?

    3. have you printer connected to the computer?

    Method 1

    See the Microsoft articles below and try the steps mentioned them, check if it works very well.

    Error messages when you start a Windows XP-based computer and then try to download Windows updates

    http://support.Microsoft.com/kb/931852

    Generic host process error message and a flashlight icon appear

    http://support.Microsoft.com/kb/821690

    Method 2

    Even after following the steps above if you are unable to access volume control and taskbar gray towers I suggest you check it persists in safe mode.

    A description of the options to start in Windows XP Mode

    http://support.Microsoft.com/kb/315222

    I hope this helps!

    Halima S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • This device cannot start. (Code 10) Click on 'Search for solutions' to send data about this device to Microsoft and to see if there is a solution available.

    Map #2 Microsoft Tun Miniport
    This device cannot start. (Code 10)  Click on 'Search for solutions' to send data about this device to Microsoft and to see if there is a solution available.
    ???

    Hi AnaSk,

    (1) since when are you facing this problem?

    (2) remember to make changes?

    The Code 10 error applies mainly to the problems of hardware driver and devices or compatibility problems between the drivers of equipment and additional software that is installed in Windows.

    Download and install the latest drivers from the computer's network adapter or the website of the manufacturer of the device.

    See the article below

    Description of errors related to the 10 Code that generates the Device Manager in Windows on computers
    http://support.Microsoft.com/kb/943104

  • How to filter for a range of dates calendar events in OS10

    In earlier versions of BlackBerry, I used blackberry.find.FilterExpression to filter the events calendar for a specific range of dates.

    However for BlackBerry OS10 I scoured the web to find a way to do it. I found:http://developer.blackberry.com/html5/apis/blackberry.pim.calendar.calendarfindoptions.html

    I also googled a lot of other sites, but I am unable to understand how to use CalendarFindOptions to refine the calendar of events of a specific timetable. For example, the current week or the next 7 days.

    I found this code example...
    Function listEvents (limit) {}
    Calendar var = blackberry.pim.calendar;
      var CalendarFindOptions = calendar. CalendarFindOptions;
      var findOptions = {}
    'Sort': [{}
    "fieldName": CalendarFindOptions.SORT_FIELD_SUMMARY.
    'desc': false
    }],
    'detail': CalendarFindOptions.DETAIL_AGENDA,
    'limit': limit
    };

    But unable to find examples how adequately limited by date?
    I'm guessing that something like this:
    'Start': new Date (' January 1, 2013, 13:00 "): CalendarFindOptions.SORT_FIELD_START.
    'end': new Date (' January 1, 2013, 16:00 "): CalendarFindOptions.SORT_FIELD_STOP.

    But it is an assumption and does not work I can find no example of how do

    Any help would be appreciated

    See the example for pimcalendar on Github:

    https://github.com/BlackBerry/BB10-WebWorks-samples/tree/master/pimcalendar

    You can find the JS to set filters of beginning and end starts here:

    https://github.com/BlackBerry/BB10-WebWorks-samples/BLOB/master/pimcalendar/index.html#L107

  • "Generic Host Process for Win32 Services has encountered a problem and needs to close" to start the computer.

    Original title: Generic Host Process for Win32

    A few days earlier, when I restarted my computer, I got an error message indicating that there was an error in the Generic Host Process for win32 and we had to close the program. The only thing it really seems to have an impact on the time is my speakers. I'm not all sounds to play, but when I turn my computer off, he will play the melody of the judgment.

    I tried to fix this problem without success. I tried to install the windowsXP-KB894391 package - x86ENU.exe as indicated on the website. However, when I try to install it, I get a message indicating
    "Setup has detected that the version of Service Pack for this system is newer than the update you are applying.
    There is no need to install this update. »
    Any thoughts?

    Hello Courtney0210,

    Thank you for the question!

    I'm sorry to know that have problems you with startup error. As I understand it, you get an error to the error of starting in the Generic Host Process for win32 and that the program had to close.

    I need to ask you a question to help you best.

    Were there any changes (hardware or software) to the computer before the show?

    Perform the steps in the link and check.

    Error messages when you start a Windows XP-based computer and then try to download Windows updates  

    Answer to us if you are having problems with error starting or any other issue of Windows, and I'd be happy to help you again and try to correct the problem as soon as possible.

    Good day!

    Hope this information helps.

  • «Get the message at startup...» "Host process for Windows Services has stopped"... and sometimes losing his

    I started getting a message every time I boot my laptop Compaq Presario CQ60. Message is "host process for Windows Services has stopped". My speaked symbol now has a red cross I've ever had before. When it turns off I often have not all sounds. I have a feeling that this has happened after an automatic update. I did a system restore, but this does not solve the problem. It's the sound that is most annoying that I never know when or where I will not have it. I hope someone can help

    To clarify, the two problems was started at the same time?

    Try to perform a clean boot in an attempt to determine the cause of the error at startup:
    http://support.Microsoft.com/kb/929135

    Try reinstalling the latest audio drivers available on the manufacturer's website.
    Also, try the other steps listed here: http://windows.microsoft.com/en-US/windows/help/no-sound-in-windows

  • Report with 2 settings of filtering by day and 3 measures for a range of dates

    Hello

    I need to establish a relationship with the following criteria:

    (a) I have 5 settings

    (b) tell of 2 measures of data should be based on a date 01/01/2015

    (c) rest of 3 data measures should be based on a range of dates say 01/01/2015-31/01/2015

    No idea how to achieve this?  If so please help me.

    Thanks in advance

    LonaD

    You cannot filter the reports by using the filter function in the formula in the column?

  • Generic Host Process for Win32 Services has encountered a problem and needs to close

    I have Windows XP Home Edition, version 2002, service pack 3

    The link to "Windows Updates" on the microsoft website does not.

    What application or antivirus security suite is installed and your current subscription?  What anti-spyware (other than Defender) applications?  What third-party firewall (if applicable)?

    A (another) Norton or McAfee application has already been installed on the computer (for example, a free trial version which is preinstalled when you bought it)?

    You see the effects of a hijackware infection!

    NB: If you had no installed anti-virus application or subscription has expired * when the machine was first infected * and/or your subscription has expired since and/or the machine is not kept fully corrected in Windows Update, don't waste your time with any of the following: Format & reinstall Windows.  A repair install won't help!

    Microsoft PCSafety provides users at home (only) with free assistance in dealing with infections by malicious software such as viruses, adware and spyware (including unwanted software).
    https://support.Microsoft.com/OAS/default.aspx?&PRID=7552&St=1

    Also available via the homepage of Support of consumer safety: https://consumersecuritysupport.microsoft.com/

    Otherwise...

    1. see if you can download/run the MSRT tool manually: http://www.microsoft.com/security/malwareremove/default.mspx

    NB: Run the FULL scan, not analysis FAST!  You may need to download the MSRT on an uninfected machine and then transfer the MRT. EXE to the infected machine and rename it to SCAN. EXE before running it.

    2A. WinXP-online Windows Live Safety Center scanner 'Protection' (only!) in Mode safe mode with networking, if necessary:http://onecare.live.com/site/en-us/center/howsafe.htm

    2B. Vista or Win7-online this scanner instead: http://onecare.live.com/site/en-us/center/whatsnew.htm

    3. now post the logs required in a forum appropriate for support by an expert in the field. DON'T SKIP THIS STEP!

    I can recommend the assistance of experts available in these forums: http://spywarehammer.com/simplemachinesforum/index.php?board=10.0, http://www.spywarewarrior.com/viewforum.php?f=5, http://www.dslreports.com/forum/cleanup, http://www.bluetack.co.uk/forums/index.phpand http://aumha.net/viewforum.php?f=30

    If these procedures look too complex - and there is no shame in admitting this isn't your cup of tea - take the machine to a local, good reputation and stand-alone computer (that is, not BigBoxStoreUSA or Geek Squad) repair facility.

    ~ Robear Dyer (PA Bear) ~ MS MVP (that is to say, mail, security, Windows & Update Services) since 2002 ~ WARNING: MS MVPs represent or work for Microsoft

  • Generic Host Process for Win32 Services has encountered a problem and needs to close, no matter who has any solution please.

    The error signature:

    SzAppName: svchost.exe, Sz App Ver: 5.1.2600.5512.

    SZ ModName: ntdll.dll, Sz Mod Ver: 5.1.2600.5755

    Offset: 00023845.

    Can someone please tell me how to solve this problem.

    My system always seems to work OK except that it will not close, it crashes with the message: Windows ends after saving the files needed.

    Hello

    1. have you done any change in software on the computer lately?

    Method 1.
    a. start your computer using safe mode (F8 tap about once per second while your computer is in the process of starting up until you get to a screen that allows you to start safe mode).
    b. once there, go to your C:\WINDOWS\ServicePackFiles\i386 folder and copy the ntdll.dll file (right click on the file itself and select COPY)
    c. and then go to your C:\WINDOWS\System32 folder and click EDIT and then PASTE.
    d. click YES to the warning about overwriting of files, and then restart your computer and check.

    Method 2.
    I recommend you to install the free security software from Microsoft. It is easy to install and automatically updated.
    Here is the link to download.
    http://www.Microsoft.com/securepc

    So I ask you to install the Windows Xp Service Pack 3 for stable performance.
    It improves the reliability of Windows by installing updates to software - new drivers for hardware and much more.
    http://www.Microsoft.com/downloads/en/details.aspx?FamilyId=68C48DAD-BC34-40BE-8D85-6BB4F56F5110&displaylang=en

    I hope this helps.

    Thank you, and in what concerns:
    Shekhar S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.
    If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

Maybe you are looking for