How can i find the 1st business day of the week ?

Hi,
How can i find the 1st business day of the week excluding saturaday,sunday and holidays? i have holiday table which contains the columns name HolidayDate and HolidayDescription.
Ex:
10-1-2011 is monday(i.e) 1st business day.check If it is in holiday table,then return the result as 11-1-2011 else return the result as 11-1-2011(which is the first business day of this week).
Can anyone tell me the Query to solve it?

Does this help:
SQL> ed
Wrote file afiedt.buf
  1  with t as (SELECT TRUNC(SYSDATE,'IW') holiday FROM dual
  2  UNION SELECT TRUNC(SYSDATE + 7,'IW') from dual)
  3  SELECT MIN(Dat),wk FROM
  4  (SELECT TO_CHAR(dat,'IW') wk,dat FROM
  5  (SELECT dat + lvl dat FROM
  6  (SELECT TRUNC(SYSDATE,'RRRR') dat, level - 1 lvl
  7  FROM dual
  8  CONNECT BY level <= TO_DATE('31-DEC'||TO_CHAR(SYSDATE,'RRRR')) - TRUNC(SYSDATE,'RRRR'))
  9  ) x
10  WHERE x.dat NOT IN (select holiday from t))
11  WHERE TO_CHAR(Dat,'DY') <> 'SAT'
12  AND TO_CHAR(dat,'DY') <> 'SUN'
13* group by wk
SQL> /
MIN(DAT)  WK
04-JAN-11 01  -- since 03-JAN-2011 is in holiday list, 04 is taken as first business day of first week
11-JAN-11 02  -- similar to week 1
17-JAN-11 03
24-JAN-11 04
31-JAN-11 05
07-FEB-11 06
14-FEB-11 07
21-FEB-11 08
28-FEB-11 09
07-MAR-11 10
14-MAR-11 11
21-MAR-11 12
28-MAR-11 13
04-APR-11 14
11-APR-11 15
18-APR-11 16
25-APR-11 17
02-MAY-11 18
09-MAY-11 19
16-MAY-11 20
23-MAY-11 21
30-MAY-11 22
06-JUN-11 23
13-JUN-11 24
20-JUN-11 25
27-JUN-11 26
04-JUL-11 27
11-JUL-11 28
18-JUL-11 29
25-JUL-11 30
01-AUG-11 31
08-AUG-11 32
15-AUG-11 33
22-AUG-11 34
29-AUG-11 35
05-SEP-11 36
12-SEP-11 37
19-SEP-11 38
26-SEP-11 39
03-OCT-11 40
10-OCT-11 41
17-OCT-11 42
24-OCT-11 43
31-OCT-11 44
07-NOV-11 45
14-NOV-11 46
21-NOV-11 47
28-NOV-11 48
05-DEC-11 49
12-DEC-11 50
19-DEC-11 51
26-DEC-11 52
52 rows selected.
SQL>

Similar Messages

  • How can I find out what is running in the background and running my batterie down

    How can I find out what is running in the background

    Hi simpbarby,
    Welcome to the Support Communities!
    The links below will help you understand what apps are running on your iPhone.  You can quit the ones that you aren't using.
    iOS: Understanding multitasking
    http://support.apple.com/kb/ht4211
    This link will provides tips to conserving battery life:
    Apple - Batteries - iPhone
    http://www.apple.com/batteries/iphone.html
    Optimize Your Settings
    Depending on how they are set, a few features may decrease your iPhone battery life. The tips below apply to an iPhone running iOS 7.0 or later.
    Enable Wi-Fi: Having Wi-Fi enabled helps consume less power when doing activities that access data. Go to Settings > Wi-Fi and log in to a Wi-Fi network.
    Adjust brightness: Dim the screen or turn on Auto-Brightness to extend battery life. Turning on Auto-Brightness allows the screen to adjust based on lighting conditions.
    Fetch new data less frequently: The more frequently email or other data is fetched, the quicker your battery may drain. To fetch data manually: Go to Settings > Mail, Contacts, Calendars > Fetch New Data and tap Manually.
    Turn off push notifications: Apps with Push Notification alert you of new data, which may impact battery life. To disable, go to Settings > Notifications, choose the app you want to disable, and do the following:
    Change Alert Style to None.
    Turn Badge App Icon off.
    Turn Sounds off.
    Note: New data will be received when you open the app.
    Minimize use of location services: Apps that actively use location services, such as Maps, may reduce battery life. You can see which applications have recently used location services by going to Settings > Privacy > Location Services.
    Use Airplane Mode in low- or no-coverage areas: Your iPhone always tries to maintain a connection with the cellular network, which may use more power in low- or no-coverage areas. Turn on Airplane Mode to increase battery life in these situations.
    Viewing Usage StatisticsKnowing and understanding your iPhone usage can help you better manage your battery life. To view your iPhone usage statistics, go to Settings > General > Usage. Under “Time since last full charge”:
    Usage: Amount of time iPhone has been awake and in use since the last full charge. iPhone is awake when you’re on a call, using email, listening to music, browsing the web, or sending and receiving text messages, or during certain background tasks such as auto-checking email.
    Standby: Amount of time iPhone has been powered on since its last full charge, including the time the phone has been asleep.
    I hope this information helps ....
    Have a great day!
    - Judy

  • I lost my macbook, how can i find it back? i have the serial number.

    i lost my macbook, how can i find it back? i have the serial number.

    you can not find it unless "find my mac" was enabled and the mac is online.  Also, read this:  http://support.apple.com/kb/ht2526

  • How to: Schedule a job to run on the first business day of the month

    In Oracle 10.2.0.3, is there a way to schedule a repeating job to run on the first business day of the month? For example, if the first of the month falls on a weekend (such as Saturday, 11/01/2008), I would like the job to run automatically on Monday (for example, 11/03/2008) instead.

    set serveroutput on
    begin
      print_dates('FREQ=MONTHLY;BYDAY=MON,TUE,WED,THU,FRI;BYSETPOS=1;',
          to_timestamp_tz('01-JAN-2008 12:00:00','DD-MON-YYYY HH24:MI:SS'), 12);
    end;
    Gives:
    TUE 01-JAN-2008 (001-01) 12:00:00 -07:00 -07:00
    FRI 01-FEB-2008 (032-05) 12:00:00 -07:00 -07:00
    MON 03-MAR-2008 (063-10) 12:00:00 -07:00 -07:00
    TUE 01-APR-2008 (092-14) 12:00:00 -07:00 -07:00
    THU 01-MAY-2008 (122-18) 12:00:00 -07:00 -07:00
    MON 02-JUN-2008 (154-23) 12:00:00 -07:00 -07:00
    TUE 01-JUL-2008 (183-27) 12:00:00 -07:00 -07:00
    FRI 01-AUG-2008 (214-31) 12:00:00 -07:00 -07:00
    MON 01-SEP-2008 (245-36) 12:00:00 -07:00 -07:00
    WED 01-OCT-2008 (275-40) 12:00:00 -07:00 -07:00
    MON 03-NOV-2008 (308-45) 12:00:00 -07:00 -07:00
    MON 01-DEC-2008 (336-49) 12:00:00 -07:00 -07:00
    and the print_dates function is (10.2):
    create or replace procedure print_dates
      cal_string in varchar2,
      start_date in timestamp with time zone,
      nr_of_dates in pls_integer
    is
      date_after timestamp with time zone := start_date - interval '1' second;
      next_execution_date timestamp with time zone;
    begin
      dbms_output.put_line('  -->');
      for i in 1 .. nr_of_dates
      loop
        dbms_scheduler.evaluate_calendar_string
         (cal_string, start_date, date_after, next_execution_date);
        dbms_output.put_line(to_char(next_execution_date,
                        'DY DD-MON-YYYY (DDD-IW) HH24:MI:SS TZD TZH TZR'));
        date_after := next_execution_date;
      end loop;
    end;
    [\pre]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How can uncompleted events carryover from one day to the next?

    Let's say I had to call Mr. Smith on Monday, but never got to call him. How can I have this uncompleted reminder carry over to Tuesday automatically?? And every day from there on until I do call him and delete the event. Is this possible??
    Any help will be most welcomed.
    Jorge L. Belendez
    MAC MINI   Mac OS X (10.4.4)  

    It will automatically remain in your task list & show a exclamation point since it isn't done. However, if you have the hide to dos with due dates outside the calendar view enabled in preferences, you won't see the older tasks if they aren't in the calendar view.
    I've posted an enhancement request to Apple & suggest you do the same so that older tasks still show outside the calendar view with that option enabled.

  • How can I find and disable Page Down in the Keyboard Shortcuts menu?

    I often accidentally hit Page Down because it's right beside my arrow keys. It seems to switch to the next symbol in the library which is something I never under any circumstances would want to do. How do I disable this incredibly annoying keyboard shortcut? I can't find it anywhere in the unsearchable rat's nest that is the Keyboard Shortcut menu.

    Aha, thank you for drawing my attention to the export html button, it does make it possible to search those keyboard shortcuts.
    In my case, View -> Go to -> Next was set to nothing. More oddly, the words "Page Down" don't appear anywhere at all in the generated file, and when I set another random command (Zoom In) to use Page Down it didn't warn of a conflict. Hitting page down zoomed in instead of switching me to another symbol, and when I cleared the shortcut from zoom in it went back to swapping between symbols. I guess I'll have to set something benign to use the page down key.
    Bizarre. I guess this must be a bug in CS6?

  • How can I find out what's running in the background?

    Hi All -
    This has been happening for quite some time and I just can't seem to figure it out.
    It seems as though my machine is constantly processing something.  I can hear it "chugging away".  Even when no applications are running.  So far I have tried the following:
    Deleting all applications I no longer use (including all of their hidden files)
    Turned off applications such as Google Drive and Drop Box (in case it was the continual syncing)
    Checked the Activity Monitor and Installed something called iStat Pro - neither of which I understand how to read.
    Can anyone give me any more suggestions? My next step would be to reformat, but we all know how cumbersome and time-consuming that can be!  Perhaps I just need more memory or storage.
    Thanks so much in advance
    S7

    Did you uninstall CleanMyMac according to the developer's instructions: How to Uninstall CleanMyMac Classic ... - MacPaw
    To verify that you've eliminated all of the files associated with CYM download and run Find Any File to search for any files with "the application's' name"  and the "developer's name" in the file name.  For example for CleanMyMac you'd do two searches:
    1 - Name contains "cleanmymac"
    2 - Name contains "macpaw"
    Any files that are found can be dragged from the search results window to the Desktop for deletion.
    FAF can search areas that Spotlight can't like invisible folders, system folders and packages.
    Download and run Etrecheck.  Copy and paste the results into your reply. It's a diagnostic tool that was developed by one of the most respected users here in the ASC to help identify the more obvious culprits.

  • How can i view appointments for a day in the monthly calendar

    how can i view appointments for a singol day in the monthly calendar?
    Thank you

    It's a problem they need to fix. Make a complaint at http://www.apple.com/feedback/

  • ¿How can I see more than a day in the calendar view of the notification center?

    Hi guys! I wanna know if there's any option to see more than a day in the calendar view of the notication center. I swear I saw a friend of mine who could see more than a day in the notification center.
    Than

    In Settings > Notification Center, try turning "on" all the six buttons under "Today View".  Also turn "on" the top two buttons under "Access on Lock Screen".  Doing that should show you "Tomorrow" at the bottom of Noticiation Center.

  • How can I find out more about books in the iBooks store?

    I've got iBooks for my iPod Touch and it works well. However when I search for stuff in the iBook Store, there is very little information apart from the title and author of a work. For example if it's a translation of a well-known book (think Tolstoy, Homer, Dumas), then probably there will be several different translations available, but iBooks store doesn't tell me which one it is offering; indeed sometimes more than one version is offered with no info about the difference between the versions. Is there any way of searching for more info on books in the store? After all, someone must have compiled the list.

    I always do the tapping, and this never tells me the kind of thing I was querying. However I have to admit the samples (which I haven't often used) do often seem to do the trick - I just sampled a few books, and since they all had title pages included in the sample, I got what I wanted from there. What they reveal about classics like Anna Karenina or The Odyssey is that the translations are often very old (frequently 19th Century) and therefore in the public domain. Nice because free, but I would not normally want to go back that far, so I guess iBooks is not the place to look for modern editions of classics?
    Anyway to be fair you have answered my question - but I would love iBooks to give access to better review material (not just user reviews that may or may not exist, but something more like Amazon's system): and really I would like them to have a lot more books from different periods (again like Amazon, or a really good bookshop). But I guess I'm not exactly iBooks' target audience.

  • How can I find out my data usage for the past 3 months?

    Greetings all, I have been a long time Verizon customer, and as such I, along with my husband, was grandfathered into the unlimited data plan. When I last spoke to a representative, they informed me that the only way we were going to be able to keep our unlimited data was by paying the full retail price ($600+) to get a new phone. So we were considering upgrading and changing to one of the newer data plans so we could still get the discounted price on the new phone, but I would like to make sure I choose one with enough data, without paying for a bunch of data that I don't use, however MyVerizon only shows me the amount I have used since the start of the billing cycle. Is there a way to find out the data usage for both my husband and myself for the last 3 months so I can choose the right option?
    Thanks in advance for your help!

        Hello sweetpea1221! How exciting that you're considering upgrading with us. mrhelper is helpful, indeed. You can view your data usage for each line under the View Bill option via your My Verizon account. You can also view your 3 month average  data usage with our Account Analysis feature. Here's a link that will be helpful in doing so http://bit.ly/vnLjqO. I'm confident that we have a great plan to match your data needs. Please let us know if you have further questions.
    TanishaS1_VZW
    Follow us on Twitter @VZWSupport

  • How can i find an excel file deleted from the server

    In our office we all have access to the main server. Recently a document that we need was deleted from the server. It's not in the trash. Can and how would we be able to find and recover this deleted document? Specifically I am looking for an excel document, and I already checked the recent docs on excel.
    thanks!

    Have the admin for the server restore the file from the backup

  • How can i find my deleted text messages on the iphone4

    My ex boyfriend figured out a way to get all my deleted messages from the last month and i want to know how i can block him from doing this again?

    Also, if the messages used Apple's iMessage, then any other device logged in using the same Apple ID and password would still have those messages regardless of whether you deleted them on your iPhone.

  • How can I subract a number of days from the sysdate() ?

    I need to display a date that is a certain number of days older than the current date.
    I tried <?xdoxslt:sysdate('yyyy-MM-dd') - 7?> but I get an error.
    Any suggestions would be appreciated.

    I coded this:
    test date : <?xdoxslt:ora_format_date_offset(xdoxslt:sysdate(),7, '-')?>
    I got this:
    test date : 110908 -- today's date, no offset.
    What did I do wrong?
    I got it to work using <?xdoxslt:sysdate() - 7?> (I removed the formatting from the sysdate), but the date format is 110901, not the most common for displaying purposes.
    Any useful hints on how to format the resulting date?

  • How can i find a number of valor in the flowing file i mean tu count the valors

    i want to find how much valors are in tjis file i mean from the NCOUNT = 8062 to the end
    Attachments:
    exampl1.txt ‏2 KB

    This works for your example I believe. If other files have something other than NCOUNT = 8062, then you'll have to do make some modifications to accomodate that but you should have something here to get you started.
    Attachments:
    Read_File.vi ‏18 KB

Maybe you are looking for

  • Can you hide individual names in a group email

    Hello there, I've trawled the discussion pages and cannot find this question, so I hope I'm not repeating it. I want to send an email via Mac Mail using the 'send to group' facility on the Mac Address book. However I want to send the email and hide t

  • ITunes Music Files Corrupted by Genius and/or iPod Touch?

    After installing an iPod Touch for the first time, and also running Genius for the first time, on my large (199.61 GB) music library (located on a WD MyBook 500 GB external hard drive), all of my music has disappeared according to iTunes. This is bec

  • Memory leak with Visa Close in loop

    I read the other posts about the memory leak problems with Visa Close, but eliminating the Visa Close from VI causes problems with read & write (it seems to go out of sync). Any suggestions? Example attached. Attachments: MKS_651C_Serial_Communicatio

  • Servlets and sessions - good practices

    Hello, This is a newbie question. The scenario: Let's say I made a bank application that allows a user to log in and view 2 pages; the simple home page with just some static content and then a dynamic page that lists the last 10 transactions fetched

  • Where to find the performance counter information?

    Code: class Program static void Main(string[] args) if(CreatePerformanceCounters()) Console.WriteLine("Created performance counters"); Console.WriteLine("Please restart application"); Console.ReadKey(); return; var totalOperationsCounter = new Perfor