function/SQL to get the next weekend date of SUNDAY, in light of the current sysdate

Hi all

someone at - it a reliable piece of SQL or the function that takes the current SYSDATE as a parameter and returns the next date available weekend (SUNDAY)

So for example if it is adopted as of today 01/07/2009 (Wednesday) it returns data 07/05/2009, which is the Date of Sunday following.

Even if I went to Sunday 07/05/2009, it would go back the date 07/12/2009, which is this Sunday.

Any help in advance apppreciated!

Kind regards
Satnam
select next_day(sysdate, 'SUNDAY') from dual

Good luck

Tags: Database

Similar Questions

  • write an analytical function custom to get the current time

    Hi all
    I want to write a custom analytical function to get to the current week.
    for example if it is today, January 13, 2012 then during week 2 the analytical function must return true.

    I have an existing analytical function for the passage of time, written by someone else as below.

    Decode (connect_by_root (LASTDATE) - trunc (sysdate),-1, 1, 0)

    here last date it receives from the other query. This function returns me if the current date is passed or not.

    So can someone please tell me how to write a custom function to get the current week.


    Thank you
    Prateek

    Published by: 804658 on January 13, 2012 02:10

    I have an existing analytical function for the passage of time, written by someone else as below.
    Decode (connect_by_root (LASTDATE) - trunc (sysdate),-1, 1, 0)

    Is not an analytic function.

    I guess (because we don't know) that you need a function analytical, because you have a start date, but no end date and so an analysis as an ADVANCE or a DELAY can help you get the end_date.

    If so, then maybe this shows you in the right direction.
    I limited to 5 weeks to keep the short output.
    I chose a start date of January 3, 2012.

    SQL> WITH my_cal AS
      2  (select ROWNUM week_no
      3   ,      TO_DATE('03-JAN-2012','DD-MON-YYYY') + (ROWNUM-1)*7 start_date
      4   FROM   DUAL
      5   CONNECT BY  ROWNUM <= 52)
      6  SELECT *
      7  FROM   my_cal
      8  WHERE  week_no <= 5;
    
       WEEK_NO START_DAT
    ---------- ---------
             1 03-JAN-12
             2 10-JAN-12
             3 17-JAN-12
             4 24-JAN-12
             5 31-JAN-12
    
    SQL>  WITH my_cal AS
      2   (select ROWNUM week_no
      3    ,      TO_DATE('03-JAN-2012','DD-MON-YYYY') + (ROWNUM-1)*7 start_date
      4    FROM   DUAL
      5    CONNECT BY  ROWNUM <= 52)
      6  SELECT week_no
      7  ,      start_date
      8  ,      LEAD(start_date) OVER (ORDER BY start_date) - 1 end_date
      9  FROM   my_cal
     10  WHERE week_no <= 5;
    
       WEEK_NO START_DAT END_DATE
    ---------- --------- ---------
             1 03-JAN-12 09-JAN-12
             2 10-JAN-12 16-JAN-12
             3 17-JAN-12 23-JAN-12
             4 24-JAN-12 30-JAN-12
             5 31-JAN-12
    
    SQL> WITH my_cal AS
      2  (select ROWNUM week_no
      3   ,      TO_DATE('03-JAN-2012','DD-MON-YYYY') + (ROWNUM-1)*7 start_date
      4   FROM   DUAL
      5   CONNECT BY  ROWNUM <= 52)
      6  SELECT *
      7  FROM (
      8   SELECT week_no
      9   ,      start_date
     10   ,      LEAD(start_date) OVER (ORDER BY start_date) - 1 end_date
     11   FROM   my_cal)
     12  WHERE  TRUNC(SYSDATE) BETWEEN start_date AND end_date;
    
       WEEK_NO START_DAT END_DATE
    ---------- --------- ---------
             2 10-JAN-12 16-JAN-12
    
    SQL> 
    
  • problem to get the current date in qml

    Hello world

    I'm trying to get the current date in c ++ and qml and I used the class QDate, but it still has some problems:

    Code:

    =====================================================

    QDate * nowdate = new QDate;
    QDeclarativePropertyMap * nowdateMap = new QDeclarativePropertyMap;
    nowdateMap-> insert ("date", QVariant (nowdate-> currentDate()));
    QML-> setContextProperty ("nowdateMap", nowdateMap);

    ===========================================================

    After setting the nowdateMap, I'm able to get the date in the application, but the format is really weird, I did not use QDatetime, but the restult of shows like ' 2013-1 - 3 T 00: 00:00 ", how can I get rid of the final"T00:00:00 "? or is there a better way to get the current date?

    Thank you

    QDate nowdate is QDate::currentDate();.

    QString nowdatestring = nowdate.toString (); / / to get the date string format, you can define the shape of toString(), you can //search it
    QDeclarativePropertyMap * nowdateMap = new QDeclarativePropertyMap;
    nowdateMap-> insert ("date", QVariant (QString (nowdatestring)));
    QML-> setContextProperty ("nowdateMap", nowdateMap);

    then in the file qml, using nowdateMap.date will do.

  • How to get the current date to display in the Spanish format.

    The coding is in format Adobe Acrobat, DC. The coding I have for the English today's date is:

    var d = new Date();

    sDate = util.printd var ("dd mmmm yyyy", d);

    this.getField("Text1").value = sDate;

    How can I get the current date displayed in this Spanish format: 07 December 2015

    Thank you

    It's a little complicated... But this code should do the trick:

    util.printd("dd", d) + " de " + util.printd("date(es){MMMM}", d, true) + " de " + util.printd("yyyy", d);
    

    Edit: Fixed the code... Did not notice the 'of' second before.

  • Adaptive tags: pt: data .currpagedata - could not get the current page id

    I use a Basic Page layout and need to create a DIV box which is linked to the Page ID - < div id = "pt-page-1234" >. The Page ID must be inserted dynamically when you navigate around the pages.

    I try to use the Adaptive tags pt: data to get the ID of the current Page; Therefore, I am currpagedata. When I use the attribute of the object ID of the object, I get the Community ID (which seems to be a bug).

    Does anyone know how I can get the current Page ID on a pt tag: data? Here is my current code:

    < pt:ptdata.currpagedata pt:id = "currPage" / >
    < pt:logic.foreach pt: data = "currPage' pt:var = 'temp' >
    < pt:logic.variable = pt pt:key: value = "$temp.objid" / "currPageId" >
    < /pt:logic.foreach >
    < pt:logic.concat pt:key = 'target' pt:value1 = 'pt - page -"pt:value2 ="$currPageId"/ >
    < pt:core.html pt:tag = "div" id = "$target" >

    I get... < div id = "pt-page-245" > but the page ID is 4015

    Published by: user11124236 on July 2, 2010 10:44

    Hello

    This may be too late, but for other people who have the same problem, use. PageID instead of .objid (case-sensitive).






    See you soon,.

    Jefi Santoso
    Collaboration technologies (http://www.collaborativetechnologies.com.au)

    Edited by: jefis on 14-Sep-2010 17:20

  • get the current date for condition satisfied

    Hello world

    I want to get the current date for the following query.

    SELECT B.NAME, C.FST_NAME, C WHERE S_CONTACT, S_ORG_EXT B, C.LAST_NAME OF S_PARTY_PER A (B.ROW_ID = A.PARTY_ID AND C.ROW_ID = A.PERSON_ID AND A.PERSON_ID IN (select D.NEW_VAL from the S_AUDIT_ITEM where D.OPERATION_CD = 'Associate' and OPERATION_DT = 'I want the current date from 07/10/2008 12:00:00 AM to 07/10/2008 23:55:55 '))

    Help, please...

    Hello

    Like this?

    SELECT B.NAME, C.FST_NAME, C.LAST_NAME
      FROM S_PARTY_PER A, S_ORG_EXT B, S_CONTACT C
     WHERE (B.ROW_ID = A.PARTY_ID AND C.ROW_ID = A.PERSON_ID AND
           A.PERSON_ID IN
           (select D.NEW_VAL
               from S_AUDIT_ITEM D
              where D.OPERATION_CD = 'Associate'
                and trunc(OPERATION_DT) = trunc(sysdate)
    --                'i want current date start from 10/7/2008 12:00:00 AM to 10/7/2008 11:55:55 PM'))
    
  • Get the current value of the menu a cluster ring

    Hello

    I am trying to program a bunch of rings of menu to use the same options and disable the option even in the other rings of menu if it has already been chosen. It works essentially as is at the moment, but it shows each button by using a 'deactivated' option because I'm turning off the option even in the buttons that have this value. I did it using a loop knot and property and [] DisabledItems en mass. Now, I want to go to the iteration of the loop for the menu ring which already has this value.

    To do this however, I want to get the current numeric value of the ring of menu and an array of search values. If the value of menu rings appear in this table, then I want to move to the current iteration of the loop. The problem I have is that when I try to use a property node and type the property value, instead of giving me a long 32 output, it gives me the so-called 'Variant', which I have not seen before. I'm not sure how to find a table and see if the value I have is in this table. "Search table" seems just an index to be returned, I think that I want a Boolean or something. I'm also not sure how to skip an iteration of the loop (although I imagine it won't be too difficult to understand mine, I hope).

    I apologize if this is very obvious, or if my message is not clear. I started using LabVIEW, a few weeks ago and I'm still learning. I have included a picture of my Subvi downstairs.

    Thank you
    Nathan

    Variant of data allows to convert the variant to a numeric type (whatever representation you need).

    Search D 1 table returns-1 if the element was not found.  If you just compare the index with a greater or equal to zero and the result will be if the element was found in the table.

  • Get the current value of a control of the ring

    I have a control of the ring that has the following values. See attacment. I need to get the current value of this one and use it as input for another function, but First I would like to get the current value and save ina text file. I tried this

    if (event == EVENT_LEFT_CLICK_UP) || (event == EVENT_LEFT_CLICK_DOWN)
    {
        int p;
        GetCtrlVal (panelHandle, PANEL_RINGSLIDE_1, &p);
        FILE *OutFile = fopen("C:\\Users\\Student\\Desktop\\ringtest.txt","w");
        fprintf(OutFile,p);
        fclose(OutFile);
    
    }
    

    I need to get the current value of the ring (& p) to write to the file ringtest.txt.

    Also, I need to use this value (& p) as another entry in the same program.

    IE value of & p must be used in

    b = c * 5; where c is the value of the current & p.

    Can any 1 help?

    You're right: EVENT_LEFT_CLICK_DOWN is not a valid event for the CVI. Valid events are listed in the userint.h file, and are the only events that can be caught in the trap in a point of order. On the other hand, you're assuption on EVENT_VAL_CHANGED is correct: you can trap forget the EVENT_CLICK_UP event.

    According to the second question, looking at the definition for fprintf you must pass a string format as the second parameter to the function, then the value to write to the file. In your case, the correct syntax is:

    fprintf (OutFile, "%d", p);

  • How can I get the current state "onto the Pixels?

    Hello community,

    Here's the function that creates a switch that handles "snap to Pixels":

    index.html:

    <div id="STP_input" onclick="switchOnOff(this)">
         ...
    </div>
    

    main.js:

    $("#STP_input").click(function () {
         var a = switchOnOff(this);
         if (a) {
              csInterface.evalScript('switchSTP(true)');
         } else {
              csInterface.evalScript('switchSTP(false)');
         }
    });
    

    HostScript.jsx:

    function switchSTP(checkBTN) {
        'use strict';
        
        var condition;
        if (checkBTN === true) {
            condition = true;
        } else {
            condition = false;
        }
    
        var idsetd = charIDToTypeID( "setd" );
        var desc26 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref6 = new ActionReference();
            var idPrpr = charIDToTypeID( "Prpr" );
            var idtoolsPreferences = stringIDToTypeID( "toolsPreferences" );
            ref6.putProperty( idPrpr, idtoolsPreferences );
            var idcapp = charIDToTypeID( "capp" );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idTrgt = charIDToTypeID( "Trgt" );
            ref6.putEnumerated( idcapp, idOrdn, idTrgt );
        desc26.putReference( idnull, ref6 );
        var idT = charIDToTypeID( "T   " );
            var desc27 = new ActionDescriptor();
            var idtransformsSnapToPixels = stringIDToTypeID( "transformsSnapToPixels" );
            desc27.putBoolean( idtransformsSnapToPixels, condition );
        var idtoolsPreferences = stringIDToTypeID( "toolsPreferences" );
        desc26.putObject( idT, idtoolsPreferences, desc27 );
        executeAction( idsetd, desc26, DialogModes.NO );
    
        return;
    }
    

    But when I hide the Panel and show once again, that the switch back to the default state, turn on my Panel, not "hook to Pixels" PS settings setting. Is it possible to get the current status 'Hang the pixels' setting? How?

    Best regards.

    See post 8 in this thread:

    Re: Need someone to update or create script: "snap to grid of pixels.

  • I want to test, if I get the current sequence or original DDL?

    Oracle 11 g 2

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

    Hello

    I want to test, if I get the current sequence or original DDL... Once we start using the sequences, sequence values will change and I would like to know if I use the query to get the original below sequence creation DDL is correct? I don't want to get the current values of the sequence to create another sequence which makes no sense. Thank you!

    SELECT DBMS_METADATA. GET_DDL ('SEQUENCE', 'SEQUENCE_NAME') OF THE DOUBLE

    You say that my motion does not give me the original DDL, it gives only the current DOF in sequence... Fix? Is it possible to get the original values?

    No, it's the other way around. You get the original values (last number is not reported) GET_DDL (Data Definition Language) gets you the definition of the object

    Min value 1
    Max value 9999999999999999999999999999
    Increment of 1
    Cycle flag N
    Flag of the order N
    Cache size 20
    Last number 100

    Concerning

    Etbin

  • How to get the current value of db in backing bean

    Hello

    I use jdeveloper 11.1.2.3.0

    I would like to know how I could access the old value of an attribute in backing bean.
    I know I can get it in terms of EntityImpl with the getPostedAttribute function,
    but as I see that I'm not allowed to access this function in the ViewImpl.
    I get this error:
    Error (151,33): getPostedAttribute (int) has protected access to oracle.jbo.server.EntityImpl.

    Could you help her?
    What is the right way to get the current value on db in backing bean?

    Thank you very much!

    You can add a transitional attribute to the entity object to hold the old value of the desired attribute, then you can add this attribute to the view object.
    Check [url http://www.youtube.com/watch?v=iKVIiK0FBXI] retrieve the previous value of an attribute ADF BC

  • How to get the current selected action.

    Hello

    I would get the currently selected action.

    Please refer to the image below. Vignette (selection) is selected.

    Is there a script that I could use to get the which?

    Your help is very appreciated.

    Untitled-1.jpg

    getSelectedAction()
    function getSelectedAction(){
        var ref = new ActionReference();
        ref.putEnumerated( charIDToTypeID("Actn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
        try{
            var desc = executeActionGet(ref);
        }catch(e){ return; } // no action selected
        var selectedName = desc.getString(charIDToTypeID("Nm  "));
        var selectedIndex = desc.getInteger(charIDToTypeID("ItmI"));
        var parentName = desc.getString(charIDToTypeID("PrNm"));
        var parentIndex = desc.getInteger(charIDToTypeID("PrIn"));
        if(isActionSet( parentIndex, parentName )){
            var setName = parentName;
            var actionName = selectedName;
        }else{
            var setName = findAction(parentIndex, parentName );
            var actionName = parentName;
        }
        return [setName,actionName];
    };
    function isActionSet( parentIndex, parentName ){
       var res = false;
       try{
          var ref = new ActionReference();
          ref.putIndex( charIDToTypeID( "ASet" ), parentIndex );
          var setName = executeActionGet( ref ).getString(charIDToTypeID("Nm  "));
          if(setName == parentName) res = true;
       }catch(e){}
       return res;
    };
    function findAction(parentIndex, parentName ) {
      var i = 1;
      var found = false;
      while (!found) {
        var ref = new ActionReference();
        ref.putIndex(charIDToTypeID('ASet'), i);
        var desc;
        try {
          desc = executeActionGet(ref);
        } catch (e) {
          break;
        } finally {
        }
        if (desc.hasKey(charIDToTypeID('Nm  '))) { ;
          var setName = desc.getString(charIDToTypeID('Nm  '));
            var ref = new ActionReference();
            ref.putIndex(charIDToTypeID('Actn'), parentIndex);
            ref.putIndex(charIDToTypeID('ASet'), i);
            try{
            var adesc = executeActionGet(ref);
            var actName = adesc.getString(charIDToTypeID('Nm  '));
            if(actName==parentName) return setName;
            }catch(e){}
          }
        i++;
        }
    };
    
  • get the current event (name) of a field - possible / how to?

    Hello

    I wonder if it is possible to get the name of a field as event:

    (form.pag1.mytextfield::enter - JavaScript, client)

    var eventname = this.MagicJSfunction();
    

    It is of course possible to get the current name of the event with:

    (form.pag1.mytextfield::enter - JavaScript, client)

    var eventname = event.name; 

    It's a shame it's always = 'Focus' wherever I use it (form.pag1.mytextfield::ENTER - JavaScript, client) (form.pag1.mytextfield::EXIT - JavaScript, client)

    (form.pag1.mytextfield::enter - JavaScript, client)

    my_scripting_obj.my_set_design_function(this, eventname);

    Reason:

    I use to change the structure of a field in realtion to his event in my script object. By calling the function of my script object, I'd use some copy/paste.

    I have more than 120 field where this function must be called to enter and exit the event.

    Hello

    Does that help? http://assure.ly/h8ZLr5.

    In this case, I call the function entry and exit of the events of each field.

    Niall

  • I reinstalled Firefox Desktop, I downloaded my favorites of Carbonite, how can I get the current Firefox to accept?

    See above

    I reinstalled Firefox Desktop, I downloaded my favorites of Carbonite, how can I get the current Firefox to accept?

    You do backup your bookmark as a .json file?

    Restoration of bookmark

  • I want to get the current music, I have on my iPod out of it and start again. How can I do this?

    I want to get the current music, I have on my iPod out of it and start again. How can I do this?

    Open iTunes, plug in the iPod, select what you want to be on your iPod, sync.

Maybe you are looking for

  • Scam text Apple ID and password

    Just got a text that reads "8137160007@***a*t.net, SUBJ:mesg MSG:i.Apple decided to suspend your ID, we confirm within 24 hours http://aagmi.com/apple.verify.php.".  Not true! I clicked on the link and it took me to a web page of Apple nickname askin

  • Mousepad not working do not at all.

    Hello I use HP envy 17 notbook PC. This is a 2 month old. Since today morning the mouse pad is not working all of a sudden. I had to use the usb mouse to work. I tried all means to install the drivers and all the other stuff but its not working. Plea

  • printer stops with the error message

    CP3505n guard error 49.4C02 extinguish, put display running, what I'm doing, but it keeps just showing the same error

  • Road Trip...

    I have a Dell laptop, Inspiron, and I'm about to take a road trip with my brother, the trucker. Y at - it no power adapters "friendly vehicle" that I can use to power and charge my cell phone, or am I stuck buy a UPS?

  • Windows 7 - display size too big

    Just replaced XP with Windows 7 on my Dell PC and now the graphica are much too large for the screen. I tried to change the resolution, but it makes it just worse. Did I miss something?