Logic to find particular weekdays after a given date, using SQL

Hello Experts,

Version: Oracle 11G

Could you please help me with logic to find a day of special week after a date in SQL
For example, I need to know the first Friday after today's date.

Thank you for your help.

I hope that under query will be useful for you.

SELECT NEXT_DAY(SYSDATE,'FRIDAY') "NEXT DAY"
FROM DUAL

Output:

        NEXT DAY
     2/24/2012 12:06:48 PM

Tags: Database

Similar Questions

  • Find the content after the last tab use GREP

    Hi all

    Is it possible to find the content after the last tab use GREP?

    Please see the screenshot below:

    Screenshot, I highlight the required text.

    Screen Shot 2014-05-27 at 5.11.29 PM.png

    Thanks in advance

    Siraj

    Hi Sriaj,

    Try to find this in Grep.

    \t[^\t\r]+$

    Kind regards

    Cognet

  • Find an attribute value Boolean inferred at a given date in the past

    Hello

    Need advice on below:

    Looking to find a value of the Boolean attribute to a given date in the past.

    Ex: [b1] condition A is true if

    age < 18 of the person and (the age is calculated using the date of the assessment [this is a basic attribute spent] year subtracted by year Date of birth of the person)

    the person has met the State B (may be that there is a finding of another rule that serves here as a condition which, in turn, uses the date of assessment)

    Looking to find if the [b1] was true at another date in the past. (for example a 6-7 month date before the date of delegated review)

    The function according to temporal but he explores always give the date [b1] value assessment and not the past date we want to find the value of.

    Thank you.

    In the example, the conclusion rule (condition A is true) will have a constant value (true or false) if there is no temporal logic feeding, i.e. no attributes with temporal values and no temporal function. However, if 'the person we met condition B' has changepoints, then it will be the conclusion.

    For example, if the value of ' the person met the condition B is initially 'false' and become 'true' to a point of change on 01/01/2014, then "condition A is true" will be set to 'false' at the start and 'true' 01/01/2014.

    Temporal data in the Debugger entry: http://docs.oracle.com/html/E48373_01/toc.htm#Debugging/Debug_temporal_rules_and_data.htm#Enter

    Temporal reasoning can be very powerful when used correctly, but most of the time it is exaggerated and made just the things more complicated than they should be. Most date calculations can be addressed with functions and logic of regular date.

  • Search for records after (or before) a given date

    Hello

    I am trying to build a query based on a pa_credat from the given input date, the following logic must be applied:

    -Find the ID of the first (chronologically) record in a table where credat > = pa_credat.
    -If no such record exists, find the first record where credat < pa_credat. First of all mean closer here in the time of pa_credat.

    Consider the records in the table as a timeline. Since a certain date, I need to find the nearest registration or thereafter, and if there isn't, find the record closest before that date.

    I'm doing all this in a sql statement, but I think that it is neither elegant nor efficient (on a large data set):
    select objectid
    from ( select objectid
           from ( select objectid, credat
                  from ( select objectid, credat
                         from   mytable
                         where  credat >= pa_credat 
                         order by credat asc )
                  where  rownum = 1
                  union all
                  select objectid, credat
                  from ( select objectid, credat
                         from   mytable
                         where  credat < pa_credat 
                         order by credat desc )
                  where  rownum = 1 )
           order by credat desc )
    where rownum = 1
    Is there a better approach to this problem?

    Some examples of data:
    create table mytable
    ( objectid integer,
      credat   date );
    
    insert into mytable values (1,to_date('01-03-2011','DD-MM-YYYY'));
    insert into mytable values (2,to_date('02-03-2011','DD-MM-YYYY'));
    insert into mytable values (3,to_date('03-03-2011','DD-MM-YYYY'));
    insert into mytable values (4,to_date('04-03-2011','DD-MM-YYYY'));
    insert into mytable values (5,to_date('05-03-2011','DD-MM-YYYY'));
    insert into mytable values (6,to_date('06-03-2011','DD-MM-YYYY'));
    insert into mytable values (7,to_date('07-03-2011','DD-MM-YYYY'));
    The entry / the following output should

    01/01/2011-> objectid = 1
    03/01/2011-> objectid = 1
    03/03/2011-> objectid = 3
    04/01/2011-> objectid = 7

    My version of db is 10.2.0.4.0.

    Thank you very much!

    Pleiadians wrote:
    Thanks, I'll try that!

    Based on your suggestions that I came to the next solution

    select objectid
    from ( select objectid
    ,      row_number() over (order by sign(pa_credat-credat),abs(pa_credat-credat)) rn
    from   mytable )
    where  rn = 1;
    

    The rising sign order ensures that records with credat > pa_credat are first. The only problem is with the credat = pa_credat case... the sign = 0.

    Right; SIGN returns-1, 0 or 1, but you want to 0 sort before-1. You can use CASES or DECODE to return-2 instead of 0. That would leave the ORDER BY clause with

    • 2 expressions
    • 1 CASE or DECODE
    • 2 date arithmetic operations
    • 2 (SIGN and ABS) function calls

    Why would you want to do rather than what I posted, which contains
    • 2 expressions (ditto)
    • 1 CASE or DECODE (ditto)
    • 0 day of arithmetic operations (not 2)
    • function calls (not 2) 0

    ? Which means less coding? Which is more effective? Which seems easier to read and debug?

  • Equium A200-15I can't find wireless networks after recovery

    After making a recovery using the Vista CD from my computer (an Equium A200 15I) cannot find wireless networks. I went into the device under network adapters Manager and then there is realtek RTL8101 Ethernet NIC etc and in the other devices section it is Ethernet and controller of Stoeage of mass.

    I'm not really sure how I can get the computer to recognize and wireless networks, but I am aware that the driver is missing!

    Hello

    Try to update the wlan driver:

    http://APS2.toshiba-tro.de/WLAN/?page=downloads

    You can also check for other drivers if it is not installed:

    http://EU.computers.Toshiba-Europe.com/innovation/download_drivers_bios.jsp

  • Windows Vista cannot find any networks after reformat

    Windows Vista cannot find any networks after reformatting. Help!

    Go to the website of the manufacturer of your computer/notebook > drivers and downloads Section > key in your model number > look for it last network adapters Vista drivers > download/install the.

    The computer you are using now if you have an Internet connection with the other > download / save drivers > copy them into Flash Drive > transfer / install on another computer/laptop.

    See you soon.

    Mick Murphy - Microsoft partner

  • where can I find the installation after that I bought

    where can I find the installation after that I bought

    Hi James Bennington,

    There is no need to install anything.

    You can just connect to "https://cloud.acrobat.com/convertpdf" using your Adobe ID credentials and try to create PDF or combing different files into a single PDF file.

    Kind regards

    Ana Maria

  • Unable to find PDF printer after I installed Mac CS6 in my MacBook Air... Please help ~.

    Hello... Unable to find PDF printer after I installed Mac CS6 in my MacBook Air... I had CS4 (Windows) before, but it comes with the printer PDF ~ can anyone help? Thank you...

    What is done on the Mac, is to use the PDF button in the print dialog box, and then select SAVE it in ADOBE PDF drop-down choice. This is equivalent to printing to a postscript file and running through Adobe Distiller.

  • find the 3rd Friday of the month at a given date

    How can 3rd Friday of the month at a given date? I can always spend the first day of the month as input

    for example, the effective date is 1 January 09. need to get the 3rd Saturday 16 January 09 (Jan has 5 Friday 02, 09, 16,23,30)

    entry date: 1 February 09, needed 20 February 09

    Published by: user520824 on April 1st, 2009 12:30

    How about you...

    select trunc(sysdate,'mm') + (6 - to_char(trunc(sysdate,'mm'),'d')) + 14 from dual;
    
    TRUNC(SYS
    ---------
    17-APR-09
    
    select trunc(to_date('01-JAN-09'),'mm') + (6 - to_char(trunc(to_date('01-JAN-09'),'mm'),'d')) + 14 from dual;
    
    TRUNC(TO_
    ---------
    16-JAN-09
    
    select trunc(to_date('01-FEB-09'),'mm') + (6 - to_char(trunc(to_date('01-FEB-09'),'mm'),'d')) + 14 from dual;
    
    TRUNC(TO_
    ---------
    20-FEB-09
    
    select trunc(to_date('01-MAR-09'),'mm') + (6 - to_char(trunc(to_date('01-MAR-09'),'mm'),'d')) + 14 from dual;
    
    TRUNC(TO_
    ---------
    20-MAR-09
    
  • Removed USB controllers: can not return - "this device cannot find enough free resources that it can use. (Code 12)

    Original title: removed USB controllers: can not return

    Hello

    So today I tried to connect to a printer, and it wouldn't work (separate the issue, I don't want to worry about that now)

    I've seen several messages saying: you need to uninstall the USB controllers in Device Manager and then restart your PC. The pilots would then automatically reinstalled.

    It didn't happen, and now my Dell touch screen does not work. I can miss several other USB controllers too, I uninstalled about 3 of them, but I don't know whether or not it has been reinstalled.

    I currently have:

    -Hub USB generic

    -Enhanced host controller USB Intel (R) 8 series #1-9C 26

    -USB root hub

    -Host controller compatible xHCI USB

    Note that the last of them was a symbol of error on it and reads as follows:

    "This device cannot find enough free resources that it can use. (Code 12)

    If you want to use this device, you will need to disable one of the other devices on this system. »

    Can someone please tell me how much USB controllers I should have and how to save them?

    Thank you very much

    Hi Shalini.

    Thanks for the reply, but if you read through the posts on this thread, I think you will find that it has already been suggested that I do these two things - what I've done many times without result.

    Fortunately, I managed to fix it myself.

    To satisfy your curiosity and help someone else who could see this thread with a similar problem, here are the steps I took finally solve the problem:

    ______________________________________________

    I was always convinced that the problem is basically with the xHCI USB controller that I saw always reported as not working not properly in the device (Code 12) Manager. With this in mind, I set out to see if I could determine what the device was supposed to be in conflict with. I ran msinfo32 and began to examine the conflicts/sharing section. After a while, I decided I could not see anything obviously problematic or direct me to the controller xHCI, so I gave up on that front.

    Well, if I couldn't fix the problem with the current installation, maybe that I could find another way to install the xHCI USB controller that could circumvent the flaw that seems to be caused when windows reinstalls automatically it when restarting after the abduction. So I started trying to learn more about this "xHCI USB controller" - since Googling this term has given no end of problems not related.

    In Device Manager, I found a way to isolate the details of this driver in device (somewhere under the properties I believe) Manager. This has created a custom device showing in view only a select few connects the Manager. I have spent some time in the analysis of these and found the time during which the camera has stopped working properly. Suddenly a pattern emerges. Over and over again, see you the following series of when I was hoping that allowing windows to reinstall automatically the driver would to fix:
    • Device PCI VEN_8086 & DEV_9C31 & SUBSYS_05F91028 & REV_04\3 & 11583659 & 0 & A0 has been removed

    [Rebooted PC]

    • Device PCI VEN_8086 & DEV_9C31 & SUBSYS_05F91028 & REV_04\3 & 11583659 & 0 & A0 has been configured
    • Device PCI VEN_8086 & DEV_9C31 & SUBSYS_05F91028 & REV_04\3 & 11583659 & 0 & A0 had a problem starting.

    Under each newspaper was referring to a driver name, I didn't already had access to: driver name: usbxhci.inf

    Now I got some new information about the xHCI USB controller, I took to Google. After much research (and not find something relevant), I found 2 obscure references to the driver who seemed at least somewhat relevant.
    The first reference has been a post on the forum where someone's USB ports stopped working. very similar problem to mine! There is little of any particular use in the nets, with the exception of the reference to a couple of windows updates: KB 2823516 or KB2822241

    It is not clear exactly what usbxhci.inf capacity was tied to these updates, but I made a note of them and moved.

    Another article contained no mention of specific ports USB not working does not and was centered around a different problem entirely. However, he has mentioned an another windows update: KB2919355-x 64.msu

    This one (as I remember) was clearer on the relationship between the update and changes to the usbxhci.inf file.

    Now, I had three updates which could make changes to usbxhci.inf at one point. With their name on a piece of paper, I started looking through my updates installed to see which ones I had installed. I soon discovered that Ko 2823516 or KB2822241 were not present on my PC, which saved the penalty to guess who would be the right to uninstall first.

    KB2919355 has been installed, and I made the decision to uninstall it, because as far as I knew, this update changed something in usbxhci.inf. After the initial uninstall was completed, but before the mandatory reboot for changes to take effect, I went into Device Manager and removed the xHCI USB... because I was afraid that if the new, "defective" was always present during the reinstallation of the update, it doesn't change anything.

    The device is removed once more, I rebooted the system. He drives for a considerable period, uninstall the update and then seems to have some sort of hitch; declare something in the sense of "we could not complete the operation. Changes to undo. " He stayed like that for a while before the system became operational again and began to "prepare windows. Once it was over, I discovered that my touchscreen and USB ports worked very well.

    Investigation later showed that the compatible USB xHCI host controller was is no longer marked with warnings. In addition, a series of USB controllers appeared that had not been there when the xHCI device was defective. I was also pleased to note that the update of windows for KB2919355 had already been reinstalled without messing up anything.

    _________________________________________________

  • This device cannot find enough free resources that it can use. If you want to use this device, you will need to disable one of the other devices on this system (Code 12)

    Guys, I have a problem. So, my laptop has 2 graphics cards, an integrated course of the Intel HD graphics (which works perfectly) and the other being the dedicated Nvidia graphics (Nvidia GeForce 940 m). Until 2 days ago, everything was going well and running.

    I have the application experience GeForce and it prompted me that there is a new driver update should I download. He started to install then after rebooting to complete the installation, it failed. I checked my device manager and saw a yellow exclamation under under my Nvidia graphics card (remember, my laptop has two graphics cards: Nvidia graphics card and Intel HD graphics that works correctly). I immediately checked the details, and he said:

    "This device cannot find enough free resources that it can use. (Code 12) »

    "If you want to use this device, you will need to disable one of the other devices on this system."

    This seemed very strange, because it was LITERALLY working properly before I was invited about update driver I got, so I don't know what to do - as a matter of fact, literally, I finished this game, Deadpool, with my Nvidia card that I put as the default graphics card, a few hours before , so I don't know why this happened. Any help? I'm looking for a logical answer to this, guys!

    Additional information:

    A few days before this happened, I went to my store local pc and installed an extra 4 gigs of ram on my 4 existing to make 8. Don't know if it's useful, but anyway

    If I pick up my laptop and shake it side by side, I hear a slight rattling noise, and it seems a little loose (I found this out after seeing the error message). The noise seems to come from just below the middle of my keyboard (I'm using a laptop). If for some reason, my Nvidia card is loose? Is this possible?

    I am quite technologically inclined, but not to the extent of removing components and reconstruction cell phones / pc and access the bios and what not. I can only remove/add ram.

    I want to know if its something I am able to fix it because I do not necessarily want to go running and sending my laptop places - only my pc up shop.

    Here is the location of my Nvidia card: PCI Slot 4 (PCI bus 4, device 0, function 0)

    My specs:

    Acer TravelMate p257-MG

    Windows 7 business

    Intel core i5-5200u 2.20 GHz 2.20 Ghz processor

    8.00 GB of ram

    64-bit operating system

    1 t hard drive

    940 m Intel HD graphics 5500 & Nvidia Geforce card

    Just to recap, I get the error on my Nvidia graphics card code, "this device cannot find enough free resources that it can use. (Code 12) ""If you want to use this device, you will need to disable one of the other devices on this system. »

    Thanks in advance!

    Hello

    Thank you for your response.

    I appreciate your time.

    I suggest you run ' Intel Chipset Software Installation Utility ' and check.
    Reference:
    http://www.Intel.com/content/www/us/en/support/software/Chipset-Software/Intel-chipset-software-installation-utility.html

    Please keep us updated.

    Thank you

  • I'm getting prossening exception message - c0000013Parameters 75b6bf7c 4 75b6bf7c 75b6bf7c after putting my data card.

    Original title: Exception Processing Message c0000013Parameters 75b6bf7c 75b6bf7c 4 75b6bf7c

    I'm getting prossening exception message - c0000013Parameters 75b6bf7c 4 75b6bf7c 75b6bf7c after putting my data card.

    Hello

    1 how long have you been faced with this problem?
    2. were you able to use the same card data with no problems before?
    3. are you able to use other external devices on the computer without any problem?
    4. What is the brand and model of the computer and the data card?
    5. How do you connect data card to the computer?

    Step 1: If the problem started recently, then you try to run the system restore.
    Reference: http://support.microsoft.com/kb/306084

    Step 2: Try to perform automatic Troubleshooting Services and check.
    Reference: http://support.microsoft.com/gp/hardware_device_problems

    Also, please take a look at the article.

    A card high speed SD Secure Digital does not work on a Windows XP-based computer
    http://support.Microsoft.com/kb/921413

    Some cards Secure Digital (SD) do not work correctly on Windows XP-based computers
    http://support.Microsoft.com/kb/946629

    Thanks and greetings
    Umesh P - 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.]

  • Copy the files created after a certain date

    How can I copy files that were created after a certain date?

    Thank you

    Hello

    Start - computer or Windows Explorer, you can navigate to a specific folder, then right-click on
    name (or) control position - MORE - Date created column - OK - the box, and then click the Date
    Created column that will align the content of the folder by date ascending or descending as you wish
    (click again to change the order). Then you can click on the 1st file in a sequence and hold SHIFT key and
    Click on the last file in the sequence you want - this will highlight the sequence - then right-click -.
    where in the region of high-lighted and the COPY - navigate to where you want to copy and then right-click
    on paste. To copy a group of files not in a sequence, hold down the CTRL key and click on the ones you want
    COPY that will highlight the files - right-click anywhere in the region high-lit - and then COPY
    Navigate to where you want to copy and click straight on and PASTE.

    --------------------------------

    You can search for files created after a certain date.

    Tips for finding files
    http://Windows.Microsoft.com/en-us/Windows-Vista/tips-for-finding-files

    How to use advanced search in Vista Options
    http://www.Vistax64.com/tutorials/75451-advanced-search.html

    ----------------------------------------------------------

    Win Key F opens advanced search

    Searching in Windows Vista, part 1
    http://Windows.Microsoft.com/en-us/Windows-Vista/searching-in-Windows-Vista-part-1-secrets-of-the-search-box

    Part 2
    http://Windows.Microsoft.com/en-us/Windows-Vista/searching-in-Windows-Vista-part-2-Start-menu-and-control-panel-search-tips

    Part 3
    http://Windows.Microsoft.com/en-us/Windows-Vista/searching-in-Windows-Vista-part-3-using-advanced-search-for-those-hard-to-find-files

    I hope this helps.

    Rob Brown - MS MVP: Bike - Mark Twain said it right.

  • Auto-Supprimer files after the expiration date does not

    Hello Experts,

    I need your help to remove the files/folders automatically after the expiration date in the Workpsace EMP.

    I put in place the expiry date by checking the box "" under the properties of file but is not delete the file after the expiration of the time.

    Any suggestion would be appreciated.

    Thank you

    Aravind

    Hello

    Please, try the following

    1. connect to the workspace

    2. navigate - administer - Reporting and Analysis - Services

    3. in the list of services Services of Framework RA right click and select Properties

    4. If you scroll down a bit you'll find a setting JAVA_OPTS

    5. Add the parameter mentioned above - Dgcsleeptime = 15

    6. save the changes and restart the services in a right-click and restart

    Hope this helps

    Kind regards

    Zohra.

  • After an edition upgrade to SQL Server 2008 R2 Standard, vSphere cannot communicate with the VIM_VCDB database

    My vCenter environment is 5.0 and has been initially implemented using SQL Server 2008 R2 Express as the database.  We have reached the limit of size of 10 GB for the Express version, so I want to upgrade the database 2008 R2 express 2008 R2 standard.

    Before the upgrade, I stopped the vCenter Server service before you start the SQL Server Setup program.  I did an "Upgrade Edition", to consider express standard.  It ends successfully with 2 minutes, and then I went and restarted the server vCenter service.

    However, after restarting the service, vSphere is unable to communicate with the VIM_VCDB.  For example, in vSphere if I click a virtual machine and click the performance tab, it tells me that it's impossible to view the web page.  It seems to be unable to communicate with the VIM_VCDB.  I have not changed all database names, or the ODBC settings, so not sure what is causing the problem.

    If I go to ODBC data sources administrator and test the Data Source, the test completes successfully.

    I have read all the documentation I could find and tried a few different things, but not found something that solves this problem.  I ended up having to go back to the snapshot backup, I took before the upgrade of the database edition.

    Anyone have any ideas on what the issue might be, or what should I do to solve it?

    Shane

    The database is probably fine.

    The vCenter Web Management Service running?

Maybe you are looking for

  • How can I change the default search engine in the navigation bar?

    I tried the subject: solution of config and it did not work. My search engine used to be Google, but it has changed to a random search engine that doesn't even have an official name. Is there no option in the menu dropdown. And there is no option in

  • Can't see my on my NI DAQ 6501 RS232 ports.

    Hi all I've got a NI DAQ 6501 works well... However, now I would like to use the capacity of serial port on 6501 DAQ. I checked the Max software installation, and I have no Visa & NOR-Serial installed. When I look at the PSC-2120 Max, I see the LED,

  • I try to run call of duty world at war earlier was working well and he played for about an hour

    & then I came home after running and the program does not start everytime I go to run the apps for this windows 7 tells me one "problem caused blocking the program works correctly and that windows will close the program and notify you if a solution i

  • cards - idea idea good/bad-gifts iTunes?

    My children asked for iTunes gift cards, but I don't want to buy proprietary format files, I only want to buy MP3s, I'm looking for more information.  Assistance from the iTunes store is incredibly useless until I have create a funded account (IE, gi

  • E4200 as access point (or bridge?)

    I ask for help, as I wipe the blood dripping into my eyes to beat my head against the wall. I'm trying to use my old E4200 to extend the signal wireless on the floor. What kills me, is that every time I put the E4200 to the bridge or change address i