Next_day is not giving correct date

SELECT NEXT_DAY('01-apr-2013','monday') from dual;
When i fire the above query it suppose to display '01-apr-2013' but it is displaying '08-apr-2013' which is wrong.. Pls suggest.

886248 wrote:
SELECT NEXT_DAY('01-apr-2013','monday') from dual;
When i fire the above query it suppose to display '01-apr-2013' but it is displaying '08-apr-2013' which is wrong.. Pls suggest.What is the logic behind that? Next day of today cannot be today itself, right?
You could write as,
SELECT NEXT_DAY(to_date('01-apr-2013','dd-mon-yyyy')-1,'monday') from dual;
or, if it is sysdate,
SELECT NEXT_DAY(sysdate-1,'monday') from dual; --Use TRUNC also if required..Refer the Docs
It says: NEXT_DAY returns the date of the first weekday named by char that is LATER than the date (you passed).
Edited by: jeneesh on Apr 1, 2013 10:42 AM

Similar Messages

  • In PDF to Excel conversion dates like 03/12/15 convert to Dec 3rd 2015 not the correct date of Mar 12th 2015 whereas date 03/13/2015 converts correctly as March 13th 2015

    In PDF to Excel conversion dates like 03/12/15 convert to Dec 3rd 2015 not the correct date of Mar 12th 2015 whereas date 03/13/2015 converts correctly as March 13th 2015

    Hi DirTech,
    Are both of these dates in the same Excel file? If they're in different files, are you choosing the same language for OCR (optical character recognition)?
    If they are in the same PDF file, how was that PDF file created? Was it created from a third-party application (rather than an Adobe application)? If it was created by a third-party application, it could be that it wasn't written to spec, and that's why you're seeing some oddities in the PDF > Excel conversion.  (See Will Adobe ExportPDF convert both text and form... | Adobe Community.)
    Best,
    Sara

  • Discoverer Viewer not showing correct data when scheduled

    Hi All,
    I have a bit of an ongoing issue and cannot find an answer through Oracle.
    We have an issue that when a cross-tab workbook is run manually in Desktop this returns correct data, when scheduled in desktop it returns correct data in desktop, but when opening the scheduled workbook in viewer, incorrect and irrelevant data is returned
    Here is a little information on the field that is not returning correct data;
    The field is based on a calculation, the calculation (lets call BOB) contains PL/SQL function concatenated with an NVL calculation, this other calculation is a DECODE. I have been playing with changing the content of the BOB calculation, by removing the PL/SQL function and the DECODE calc from BOB and scheduling the report, the data is returned in viewer, in fact i've attempted one without the other and this still does not return the correct data.
    This version of discoverer that is not returning data is V 10.1.2.50.05. I've tested this on a later environment with Discoverer V 10.1.55.26 and the data is returning correctly through the sceduled report in viewer.
    My questions;
    1. Has anyone ever come across something similar to this in version 10.1.2.50.05
    2. Is there any detail available regarding what upgrading to 10.1.55.26 offers?
    3. Know any workaround for using PL/SQL calculations in a scheduled workbook? I am aware that not aggregable items will not be returned in v11 when scheduling workbooks.
    Many thanks in advance for any help.
    Simon

    Bumping this thread
    Thanks
    Si

  • TS3579 I found this useful because I did not know about the effect of typing in data and that you could only drag to rearrange the data.  I had typed in data before and this had caused problems but restoring defaults did not cause correct dates to show up

    I found this  (TS3579: If the wrong date or time is displayed in some apps on your Mac Learn about If the wrong date or time is displayed in some apps on your Mac) useful because I did not know about the effect of typing in data and that you could only drag to rearrange the data.  I had typed in data before and this had caused problems but restoring defaults did not cause correct dates to show up in Finder. 

    It sounds like there are a couple things going on here.  First check if you have a successful install of SQL Server, then we'll figure out the connection issues.
    Can you launch SQL Server Configuration Manager and check for SQL Server (MSSQLSERVER) if default instance or SQL Server (other name) if you've configured your instance as a named instance.  Once you find this, make sure the service is started. 
    If not started, try to start it and see if it throws an error.  If you get an error, post the error message your hitting.  If the service starts, you can then launch SSMS and try to connect.  If you have a default instance, you can use the machine
    name in the connection dialog.  Ex:  "COWBOYS" where Cowboys is the machine name.  However, if you named the SQL Server instance during install, you'll need to connect using the machine\instance format.  Ex:  COWBOYS\Romo (where Romo
    is the instance name you set during install).
    You can also look at the summary.txt file in the SQL Server setup error logs to see what happened on the most recent install.  Past install history is archived in the log folder if you need to dig those up to help troubleshoot, but the most
    recent one may help get to the bottom of it if there is an issue with setup detecting a prior instance that needs to be repaired.
    Thanks,
    Sam Lester (MSFT)
    http://blogs.msdn.com/b/samlester
    This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click
    "Mark as Answer" and
    "Vote as Helpful" on posts that help you. This can be beneficial to other community members reading the thread.

  • Query not displaying correct data

    hi all
    my query is not displaying correct data.
    in data target secondary sales is showing 1.800 value but in query it is showing
    2.00.my requirement is my query shuld show 1.800 value. i also tried to change decimal points but not changes has happend.plz let me knw what is the problem
    thanks in advance
    shalini gupta

    With which u r reconciling the data.
    With R3 or Cube.
    I think check ur key figure, have u taken the key figure 'with TAX' one or with out tax one??
    Regards,
    Manoj.

  • Webi does not pick correct Data

    Hi Guys,
    I have a webi. The Universe for the Webi is based on  Bex Query. I see correct Data in Bex Query but when I create a webi report it does not pick correct data.
    I have checked following points already:-
    1] No Resstriction at Query Level
    2] No restriction at Universe Level
    3] No Filters/ Restriction at Webi Level.
    Can anyone suggest whats happening?
    Regards

    Hi Ray,
    It happens sometimes that data gets aggregated over all the dimension objects present in the 'Available Objects' section in webi.
    Try to pull only the characteristics present in the row section of the bex query say 'X' and measure in the column section of bex query say 'Y' into the results pane in the edit query window in webi.Then run the report and check.
    This will give you the idea about aggregation.
    Regards
    Vineeta

  • FOX CLOCKS not giving correct time. Central time is 2 hours ahead of the actual time

    FOX CLOCKS not giving correct time. Central time is 2 hours ahead of the actual time

    sorry not an Atomic clock issue I read your post wrong
    actually last night I tried to set my clock back to the time without Daylight savings and it would only let me set it to 1 or 3 am but not 2.. I noticed this, but I would wait till Sunday is over and see if this bug is only a one day issue which I have a feeling it may be, wait till 3am march 10th and see if this bug fixes itself I have a feeling it will

  • PO query not giving correct values

    Hi
    I am running the following query in PL?SQL Developer
    SELECT hou.name Operating_unit,
           pha.segment1 po_number,
           pha.revision_num,
           ap.vendor_name,
           hla1.location_code,
           papf.full_name Buyer,
           to_char(pha.creation_date, 'DD-MON-RRRR HH24:MI:SS') creation_date,
           pdta.type_name,
           assa.vendor_site_code,
           hla2.location_code,
           initcap(pha.authorization_status) po_status,
           pha.currency_code,
           pla.line_num,
           pltt.line_type,
           msib.segment1 item,
           (mcb.segment1 || '.' || mcb.segment1) category,
           msib.description,
           msib.primary_unit_of_measure UOM,
           pla.quantity,
           pla.unit_price,
           (pla.quantity * pla.unit_price) amount,
           (gcc.segment1 || '-' || gcc.segment2 || '-' || gcc.segment3 || '-' ||
           gcc.segment4 || '-' || gcc.segment5) charge_account,
           pla.list_price_per_unit,
           at.name,
           pha.freight_terms_lookup_code,
           pha.fob_lookup_code,
           initcap(pha.pay_on_code) pay_on_code,
           pha.acceptance_required_flag,
           ood.organization_code,
           ood.organization_name,
           msib.primary_unit_of_measure UOM,
           pla.quantity,
           plla.country_of_origin_code,
           (gcc.segment1 || '-' || gcc.segment2 || '-' || gcc.segment3 || '-' ||
           gcc.segment4 || '-' || gcc.segment5) charge_account,
           (pla.quantity * pla.unit_price) amount,
           plla.receive_close_tolerance,
           plla.invoice_close_tolerance,
           plla.quantity,
           plla.quantity_received,
           plla.quantity_cancelled,
           plla.quantity_billed,
           plla.match_option,
           plla.accrue_on_receipt_flag,
           plla.enforce_ship_to_location_code,
           plla.days_early_receipt_allowed,
           plla.days_late_receipt_allowed,
           plla.receipt_days_exception_code,
           plla.qty_rcv_tolerance,
           initcap(plla.qty_rcv_exception_code),
           plla.allow_substitute_receipts_flag,
           plla.receiving_routing_id,
           plla.enforce_ship_to_location_code,
           initcap(pda.destination_type_code),
           papf.full_name requestor,
           hla3.location_code,
           --pda.quantity_ordered,  -- commented because giving wrong value
           (select quantity_ordered
              from po_distributions_all
             where po_header_id IN (select po_header_id
                                      from po_headers_all
                                     where segment1 = pha.segment1)) quantity_ordered, -- Added
           (gcc.segment1 || '-' || gcc.segment2 || '-' || gcc.segment3 || '-' ||
           gcc.segment4 || '-' || gcc.segment5) po_charge_account,
           haou.name,
           prha.segment1,
           prla.line_num,
           to_char(prla.rate_date, 'DD-MON-RRRR') rate_date,
           (gcc.segment1 || '-' || gcc.segment2 || '-' || gcc.segment3 || '-' ||
           gcc.segment4 || '-' || gcc.segment5) po_charge_account,
           (SELECT acc.segment1 || '-' || acc.segment2 || '-' || acc.segment3 || '-' ||
                   acc.segment4 || '-' || acc.segment5
              FROM gl_code_combinations acc
             WHERE acc.code_combination_id = pda.accrual_account_id) accrual_account,
           (SELECT acc.segment1 || '-' || acc.segment2 || '-' || acc.segment3 || '-' ||
                   acc.segment4 || '-' || acc.segment5
              FROM gl_code_combinations acc
             WHERE acc.code_combination_id = pda.variance_account_id) variance_account,
           pla.line_num,
           plla.shipment_num,
           ood.organization_code,
           ood.organization_name,
           msib.segment1,
           msib.description,
           pla.quantity
      FROM hr_operating_units           hou,
           po_headers_all               pha,
           ap_suppliers                 ap,
           hr_locations_all             hla1,
           per_all_people_f             papf,
           po_document_types_all        pdta,
           po_document_types_all_b      pdtab,
           ap_supplier_sites_all        assa,
           hr_locations_all             hla2,
           po_lines_all                 pla,
           po_line_types_b              pltb,
           po_line_types_tl             pltt,
           mtl_system_items_b           msib,
           po_line_locations_all        plla,
           mtl_categories_b             mcb,
           po_distributions_all         pda,
           gl_code_combinations         gcc,
           ap_terms                     at,
           org_organization_definitions ood,
           hr_locations_all             hla3,
           po_requisition_headers_all   prha,
           po_req_distributions_all     prda,
           po_requisition_lines_all     prla,
           hr_all_organization_units_tl haou
    WHERE 1 = 1
       AND pha.segment1 = '6395'        --&po_number
       AND hou.organization_id = 204    --&operating_unit
       AND hou.organization_id = pha.org_id
       AND pha.vendor_id = ap.vendor_id
       AND hla1.location_id = pha.ship_to_location_id
       AND papf.person_id = pha.agent_id
       AND SYSDATE BETWEEN papf.effective_start_date AND papf.effective_end_date
       AND ((pdtab.document_type_code IN ('PO', 'PA') AND
           pdtab.document_subtype = pha.type_lookup_code))
       AND pdta.document_subtype = pdtab.document_subtype
       AND pdta.document_type_code = pdtab.document_type_code
       AND pdta.org_id = Pdtab.org_id
       AND pha.org_id = pdta.org_id
       AND ap.vendor_id = assa.vendor_id
       AND pha.org_id = assa.org_id
       AND pha.vendor_id = assa.vendor_id
       AND pha.vendor_site_id = assa.vendor_site_id
       AND pha.bill_to_location_id = hla2.ship_to_location_id
       AND pla.po_header_id = pha.po_header_id
       AND pltb.line_type_id = pla.line_type_id
       AND pla.line_type_id = pltt.line_type_id
       AND pltt.language = USERENV('LANG')
       AND msib.inventory_item_id = pla.item_id
       AND plla.po_line_id = pla.po_line_id
       AND msib.organization_id = plla.ship_to_organization_id
       AND mcb.category_id = pla.category_id
       AND pda.po_line_id = pla.po_line_id
       AND pda.po_header_id = pha.po_header_id
       AND pda.code_combination_id = gcc.code_combination_id
       AND at.term_id = pha.terms_id
       AND ood.organization_id = plla.ship_to_organization_id
       AND pda.deliver_to_person_id = papf.person_id
       AND hla3.location_id = pda.deliver_to_location_id
       AND haou.organization_id = prha.org_id
       AND haou.language = USERENV('LANG')
       AND prha.org_id = pha.org_id
       AND prha.requisition_header_id = prla.requisition_header_id
       AND pda.req_distribution_id = prda.distribution_id
       AND prda.requisition_line_id = prla.requisition_line_id
       AND haou.organization_id = hou.organization_id
       AND prla.org_id = pha.org_id
       AND prda.code_combination_id = gcc.code_combination_id    --added
       AND hla3.inventory_organization_id = msib.organization_id   --added
       AND pda.line_location_id = prla.line_location_id  --added
       AND plla.po_header_id = pha.po_header_id  --added
    I tested it for 10 POs. for 2 the query is giving right value. but for others it is giving wrong value.
    Mainly the PO Charge Account, accrual and variance account values are not matching. What changes I can make to get the correct data?
    I am using r12 version
    Thanks

    Hi Srini,
    Thanks for replying. I check and the application context is set.
    I think we might be missing certain conditions. Can you help me with that.

  • Drill Down are not giving correct values

    Hi
    We created sales Order values as a character and putting them in Rows and populating data by writing update rule. We created variables on calendar month in order to choose specific period of data in the query. For example if we need 02/2008 to 0/42008 which gives two months of data. When I drill down on Sales Order or billing document on the report it’s not giving variable interval data instead it’s pulling all the sales orders and billing documents in the Cube. With out drilling down the values are showing OK.  If I restrict with same period in the cube it's giving correct values
    Please let us know if you have any ideas.
    Thanks
    Naga

    Aah, I guessed it correctly!
    Remove the local var of the Stop button & place the terminal itself inside the inner while loop & directly wire it to the conditional terminal of the outer while loop.
    Please see the attached pic...
    Message Edited by parthabe on 07-30-2009 07:12 AM
    - Partha
    LabVIEW - Wires that catch bugs!
    Attachments:
    arrayreq_mod.jpg ‏97 KB
    arrayreq_mod.jpg ‏97 KB
    arrayreq_mod.jpg ‏99 KB

  • Stock Ledger Report in Day Wise not giving correct values for Opening Stock

    Dear Experts,
    I m working on Sock ledger report to give the day wise data.
    since yesterdays closing Stock will become opening stock of today,
    To get Opening Stock,
    I have restricted the stock key figure with 2 variables on calday        
                                  (DATE FROM var with <=(Lessthan or equal to) and offset -1
                                   DATE TO      var with <=(Lessthan or equal to) and offset -1)
    To get Closing Stock,
    I have restricted the Stock key figure with 2 variables on calday        
                                  (DATE FROM var with <=(Lessthan or equal to)
                                   DATE TO      var with <=(Lessthan or equal to) )
    But in the output Opening stock values are not coming correctly and for given range of dates,
    for last date, opening stock is showing as Zero.
    Could you please tell me how can I achieve the correct values for opening stock.
    Thanks in advance.

    Hi Arjun,
    Seems like you are making it more complicated. What is your selection screen criteria?
    Ideally you should only use the offset.
    You will have say Calday in rows and stock in Column
    ____________Opening Stock_____________Closing Stock
    01/06/2009___(Closing stock of 31/05/2009)_(Stock of 01/06/2009)
    02/06/2009___(Closing stock of 01/06/2009)_(Stock of 02/06/2009)
    03/06/2009___(Closing stock of 02/06/2009)_(Stock of 03/06/2009)
    So, from above scenario, create one RKFs and include Calday in it. Create a replacement path variable on calday and apply the offset as -1.
    So, your Opening Stock will be calculated by closign stock of previous day.
    - Danny

  • System not giving Forward date when Material will be available

    Dear All,
    I have a problem of system not giving me the forward date when material will be available in the schedule line. I will give you an example - say material - A01 , stock of same is - 500 qty available. Availability check - 02(Individual reqt), all other MRP controllers also set properly.
    Now i create Sales order for the same material  for 650qty, system confirming 500qty but not giving me the confirmed date when rest 150qty will be available in the schedule line.
    Kindly tell me which config setting needs to be enabled to get this in sales order.
    Thanks in advance...

    Is there a MRP element which could cover the remaining 150? Like a purchase or production order, for example?
    If there's none, and you still want to have a confirmation after the replenishment lead time, maintain the RLT in material master, and use/define an ATP check that is taking in consideration RLT.
    If there's such an element, use/define/review ATP checking logic, to include such elements in the check.

  • Update form not returning correct data selection in dropdown menu

    Using CS3 DW along with SQL 2008 R2. I have a number of dropdown menus on an entry form (using VBScript/ASP) that are feed by SQL queries. All data is accepted in the entry form and writes to the table in the database without any issues. I created an Update form and based on a Rec ID clicked on from a list the Update form is presented with all the data in the correct fields except for one dropdown menu. All the other menus go to the correct selection except for the one. Spent 2 days attempting to resolve this. If I change the dropdown menu to a field the correct data is presented when the form comes up, but doesn't allow the user to make a selection from the menu. When I change it back to a dropdown menu the saved selection is not selected - just lists the entire list of items in the menu. Any help or ideas on this is greatly appreciated.

    Hello All,
    Once more thank you. I have sorted the issue out.
    I observed that I was selecting the wrong field. I selected the field matching the record set of the select instead of the field matching the record set of the table I am working as seen on the image belew
    I was selecting this - This is the record set of the table that hold values for the city select list
    Instead of this. This is the record set of the table behind the form I am working on
    My issue is now re-solved.
    Mike

  • APD not loading correct data...

    Hi,
    I am using APD to load the data of a query to an ODS. In the ODS I added one more key figure that holds the total sum of the same key figure in the infocube which my query belongs to. for this aim, I added a field with a formula using SUMGT.
    when I run the query, that field works fine but when I run the model at APD that field is not filled correctly. i.e. I need that to be  the sum in the infocube but I get a very very lower value.
    Do you have any idea?
    Thanks in advance..

    Hi Yasemin,
    To use a report to load an ODS is not a good idea. The reports that you create in APD's are way different than regular bex reports. They are much slower and not reliable and also if you face a problem in the future you cannot even debug it via RSRT. There is another way to debug it which is another long story. Instead you may want to use the source it self and you can set up filters and write ABAP routines to get the same result as you use the report.
    Please let me know if I can assist you further with your APD design,
    Regards,
    Serkan

  • Timestamp when saved in text file and reloaded does not give correct dates

    Hello
    I am struggling with time stamp. I have almost corrected the problem but it is not as good as I expect it to be.
    I have data in the main vi which logs into text file with time stamp for everyday results logs.
    I then pull all this data to display on waveform graph with the performance data on y axis and time stamp on x axis.
    I convert the time stamp data from string back to time stamp using scan from function in string pallette. When I run the waveform graph vi. The time stamp data is not correct one. I see year values beginning 1974 etc. I change these values to 2011 and the correct dates and then could see the accurate logged data from data logger but I would like to have the starting date in my logged file the left most date on x-axis. I try modify dates in display format section of waveform graph but I think it gives the values in seconds which doesn't make much sense to me. Is it possible to automatically set the starting value of the graph as the first date in the logged file? I am new with using time stamps. Any feedback will be appreciated.
    Kind Regards
    Austin

    Hi Austin,
    "Is it possible to automatically set the starting value of the graph as the first date in the logged file?"
    Sure: Use autoscaling, format x-axis as time and use waveforms with correct t0 value...
    For all other questions you should attach a VI to show your current state of programming!
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • READ_TEXT Not displaying correct data

    HI abapers,
    I am using the FM READ_TEXT  for reading change document long text , for some document it gives correct data but for some other doc it give some unrelated data , when i debug i found in IMPORT statement inside the FM gives this unrelated data.
    this is my call to FM ..
    CALL FUNCTION 'READ_TEXT'
        EXPORTING
          id                           = 'AENR'
          language               = sy-langu
          name                     = tname
          object                    = 'CHANGE'
        IMPORTING
          header                  = htext
        TABLES
          lines                      = ltext
        EXCEPTIONS
          id                           = 1
          language               = 2
          name                     = 3
          not_found             = 4
          object                    = 5
          reference_check  = 6
          wrong_access_to_archive = 7
          OTHERS                  = 8.
    and import statement that gives is in SAPLSTXD program and in LSTXDFDB include line no 98
    import tline to rt_lines
      from database stxl(tx)
           client   rt_client
           id       stxl_id
           ACCEPTING TRUNCATION
           IGNORING CONVERSION ERRORS.
    this import gives worng data to rt_lines.please help in this regard.
    thanks.

    Hi,
    // check this code . I think you need to comment the importing and header
    FORM READ_TEXT .
      CALL FUNCTION 'READ_TEXT'
        EXPORTING
         CLIENT                        = SY-MANDT
          ID                            = 'ST'
          LANGUAGE                      = SY-LANGU
          NAME                          = VNAME
          OBJECT                        = 'TEXT'
        ARCHIVE_HANDLE                = 0
        LOCAL_CAT                     = ' '
      IMPORTING
        HEADER                        =
        TABLES
          LINES                         = G1_MYTABLE
       EXCEPTIONS
         ID                            = 1
         LANGUAGE                      = 2
         NAME                          = 3
         NOT_FOUND                     = 4
         OBJECT                        = 5
         REFERENCE_CHECK               = 6
         WRONG_ACCESS_TO_ARCHIVE       = 7
         OTHERS                        = 8
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

Maybe you are looking for

  • ITunes caused my Blu-ray drive to be hidden

    Hi, I recently brought my Windows 7 computer in for repair because my Blu-Ray drive became hidden while watching one of my movies. The tech support guy said that iTunes was the culprit because it makes changes to the registry for burning CD's... So h

  • Creative MuVo v100 cleaning

    Creative MuVo v00 cleaning So I have the Creative MuVo v00, gb model. I've had this mp3 player for many years, and enjoy it greatly. It still plays music fantastically, and I love the design. I wish they still made mp3 players with this design. I wou

  • Dragging items using Flash

    I know I'm using an older version of Flash (still using Professional 8) but I'm wondering if it's possible to have items be able to be more interactive in that the user can select an item with their mouse and drag it over another item and drop it on

  • Rendering in FCP problems

    When I render a file it shows as rendered. The minute I try to play it all turn red and I have to start over. It is also taking FOREVER to render. I never had this problem before and I have dumped my FCP Thumbnail cache, reset and renamed my scratch

  • Public Folder Migration issues

    Hello, I am at the last stages of migrating from exchange 2007 SP3 to 2010 SP3. Both versions have a CAS, HT, and MBX server. I've moved all the databases across and also replicated the public folder contents using:  AddReplicaToPFRecursive.ps1 -Serv