Query to find more than 3 days with the exception of weekends.

Hi all

Anyone help me with this request. On a table, I need to get all the lines that are pending for more than 3 days, outside of the weekend. No idea how to do this please?

Query

SELECT aerha.invoice_num, aerha.total amt,

ROUND ((SYSDATE-aerha.last_update_date), 0) days

OF ap.ap_expense_report_headers_all aerha

WHERE 1 = 1

AND NVL (aerha.expense_status_code, "XX") = "PENDMGR".

AND expense_check_address_flag IS NOT NULL

AND (ROUND ((SYSDATE-aerha.last_update_date), 0)) > 3

Thank you

sheebs

Hello

I guess 'weekend' means Saturday and Sunday, three days before the Wednesday (except weekend) would be the previous Friday.

Change this last condition for

AND (ROUND ((SYSDATE-aerha.last_update_date), 0)) > CASES

WHERE TO_CHAR (SYSDATE

, "DY".

, ' NLS_DATE_LANGUAGE = ENGLISH '-if necessary

) IN ("GAME", "FRI")

THEN 3

5. OTHER

END

The code you posted is looking for a difference in 3 days.  The problem is that if you run it on a Monday, Tuesday or Wednesday, then you want a difference of 5 days (3 days + 2 weekend days).  The condition above replaces the code 3 hard with a CASE expression that returns 3 or 5 accordingly.  (If there are chances that you can run on a Saturday or a Sunday, then you may need to change the CASE expression a bit.)

This kind of approach is not very good if you need take into account public holidays, or if you are looking for differences in N days, where N can be something of not known until run time.  For situations like this, see:

Need to calculate working days

Tags: Database

Similar Questions

  • How do I avoid the accumulation of color / opacity where two brush strokes overlap?  In other words, I want to use more than one path with the Paintbrush tool, but see no additive effect where strokes overlap.  What Miss me?

    How do I avoid the accumulation of color / opacity where two brush strokes overlap?  In other words, I want to use more than one path with the Paintbrush tool, but see no additive effect where strokes overlap. 5 Lightroom

    I use it all the time. Turn your opacity, density and traffic all 100%.

    Benjamin

  • How can I remove windows 10 and restore windows 7 more than 30 days after the upgrade to 10? In addition, can't find my key code... former system

    Since more than 30 days, I upgraded to windows 10 and I would LOVE to go back to windows 7.  Have no idea where my product key could be.

    http://Windows.Microsoft.com/en-AU/Windows-10/Windows-10-recovery-options

    Check if you can restore your PC to factory settings. This reinstall the version of Windows on your PC and remove your files personal, applications and drivers that you have installed, and any changes made to the settings. Go to settings > Update & security > Recovery > reset this PC > start and seek to restore factory settings.

    Discussions:

    1. http://answers.microsoft.com/en-us/insider/wiki/insider_wintp-insider_install/how-to-reinstall-or-restore-your-original-windows/b6649955-f8d3-4c0c-94ca-e4a5b5e06c60

    2. http://answers.microsoft.com/en-us/windows/forum/windows_10-win_upgrade/revert-to-previous-version/cce5dfd1-8979-4134-92ad-a74cb76a4cc1

  • What happens if I don't have internet connection for more than 30 days, with a monthly Photoshop CC license?

    I know, I have to connect to the internet to validate my monthly subscription to Photoshop CC. What happens if I can not connect to the internet for more than 30 days? It will be expired immediately, or changes in the first instance, or there is a period of grace for this?

    you will not be able to open ps after 30 days.

    (on the other hand, if it is already open on the 30th day and you leave it open, it must continue to operate unless you shut up.)

  • Acquire more than 2047 samples with the PXI-4461 instaled in SMU-1073

    Hi all, I would ask you for help with the buffer limit.

    I intend to buy digitizer PXI-4461 and he instal in SMU-1073 chassis, namely control via MXI Express of Labview installed on a separate computer.

    What I need:

    -to acquire data of a single channel of AI, but at least a sequence of 20 kS by a acquire task, in some situations until 200kS by a task to acquire.

    The question:

    - I can gain more than 2047 samples in a single sequence, like 200kS, with the PXI-4461 installed in SMU-1073?

    Internal buffer of the PXI-4461 is reserved to 2047 samples. So I'm not sure if Labview can download remotely via MXI Express the data in the buffer of the PXI-4461 via MXI Express fast enough without any affection of the sampling program.

    -in the case, this PXI-4461 with SMU-1073 isn't the right combination, what chassis and a controller can do?

    Thanks much for the reply

    Jan

    It will work for you.

    The on-board buffer 2047-sample is used only as a backup if the flow of data to the PC host (via MXI Express in this case) is not fast enough... that it will be (explained below).  DAQmx transfers data from the buffer of the device to the host PC as fast as he can and, in ideal conditions, should not save the buffer 2047 much at all.

    Let's just say you get 110 MB/s (randomly from a MXI data sheet) flow on your MXI connection.  The 4461 has 2 analog inputs, which will be at 24 bits, we just round 32-bit in case it transfers the data in this way.

    4 bytes/sample (32 bit) x 200,000 s/s x 2 (channels) = 1.6 MB/s, which is well below the 110 MB/s, which will make the MXI link.

    clear as mud?

    Germano-

  • I can't select more than one object with the SHIFT key, selected in the last Muse app

    Someone who uses the worm. last Muse CC 2014 with Mac OS 10.10.2 and had a problem of selection of several objects by using the Shift key and hold the method has a work around. It's frustrating to try to select several objects and this simple technique does not. This same shift-SELECT approach works fine on the same calculation with other products Adobe such as PS, AI, Id etc.

    I tried your suggestion to select multiple layers but no joy and no floating above the ones I had to choose. I discuss with a representative of Adobe this morning and discovered that it is possible to select more than one by dragging on the elements with the selection arrow. This forces me to block these unwanted layers selected in this shotgun approach first. It's my best work around so far. Shift-click works in the old Muse vs7.4.30 app on the same computer. I enjoyed your suggestion and hope there is a fix for the simple approach shift-click.

  • Can I use Lightroom on more than 1 Mac with the Plan of the photograph of the CC?

    I have the Macbook Pro (domestic use) and and Macbook air (which I use when traveling). If I buy the plan of photography can I use the Lightroom on both desktop application and photos of transfer between machines?

    You are allowed 2 activations as long as they are not used at the same time, so you'll be fine, you could use an external HD between the two to share the catalog and photos.

  • How to choose a system restore pt more than 5 days?

    Windows Vista 32, IE 8. I tried to do a restore of the system longer than 5 days. I created a restore point, but when I go to the system restore, it isn't here. I received a notice that the pt of restoration was created successfully. Help, please.

    You cannot create a Restore Point today for 5 days; If that's what you mean.

    By using the system restore, you can only create a Restore Point for today.

    If you mean that the RP was created more than 5 days ago, read this:

    http://www.windowsvistauserguide.com/system_restore.htm

    Read the above for a very good graph shows how backward more than 5 days in the System Restore Points by checking the correct box.

    See you soon.

    Mick Murphy - Microsoft partner

  • What query can we use... .for more than 30 days

    Select the PROPERTY, RELAVANTDATE,
    Sum (records) more)
    partition of property
    order of RELAVANTDATE
    between the '30' day interval preceding and the current line
    ) "SUM".
    of Test_Data

    What query can we use... .for more than 30 days
    can I use following or preceding
    SCOTT@soti_9> WITH Test_Data AS (
      2    select 10100 as property, to_date('25-JAN-07') as RelavantDate, 20 as notices from dual union all
      3    select 10100 as property, to_date('25-DEC-07') as RelavantDate, 5 as notices from dual union all
      4    select 10100 as property, to_date('02-JAN-08') as RelavantDate, 10 as notices from dual union all
      5    select 10100 as property, to_date('01-DEC-08') as RelavantDate, 10 as notices from dual union all
      6    select 10100 as property, to_date('02-DEC-08') as RelavantDate, 20 as notices from dual union all
      7    select 10100 as property, to_date('31-DEC-08') as RelavantDate, 20 as notices from dual union all
      8    select 10100 as property, to_date('03-JAN-09') as RelavantDate, 30 as notices from dual union all
      9    select 10100 as property, to_date('25-JAN-09') as RelavantDate, 20 as notices from dual
     10  )
     11  select PROPERTY,RELAVANTDATE ,
     12    sum(NOTICES) over (
     13      partition by property
     14      order by RELAVANTDATE
     15      range between current row and interval '30' day following
     16    ) "SUM"
     17  from Test_Data
     18  ;
    
      PROPERTY RELAVANTD        SUM
    ---------- --------- ----------
         10100 25-jan-07         20
         10100 25-dec-07         15
         10100 02-jan-08         10
         10100 01-dec-08         50
         10100 02-dec-08         40
         10100 31-dec-08         70
         10100 03-jan-09         50
         10100 25-jan-09         20
    
    8 rows selected.
    

    Kind regards
    Dima

  • Script to find the virtual computer off for more than 7 days

    Guys,

    I need a bit help I'm looking for a script that finds all the VMs who have been turned off for more than 7 days.  I would like also the names of those VM and how many days they have been turned off for a worksheet excel output.

    Thanks in advance.

    Sorry, my mistake.

    The correct script is now attached to the previous response

  • Help with more than 30 days of data

    Gurus,
    I need to create an ACCOUNTS PAYABLE OLDER STATE INVOICE where I need to know the future, more than 30 days (1-29), over 60 (30-59), over 90 (60-89). How can I get this info in the report. What are the steps I need to follow. It is an urgent report. I have not all columns related to more than 30 days... Is there a way to write sql both on the current date for this info.

    Help, please.

    Hello
    I recommend you create a logic that takes all of these buckets... More than 30, more than 60... etc.

    -case when timestampdiff (sql_tsi_day, dateColumn, current_timestamp) between 1 and 29 and then "more than 30 days.
    When timestampdiff (sql_tsi_day, dateColumn, current_timestamp) between 30 and 59 then 'more than 60 days.
    When timestampdiff (sql_tsi_day, dateColumn, current_timestamp) between 60 and 89 then 'more than 90 days.
    another end 'Undefined '.

    According to your requirement dateColumn, current_timestamp positions of columns must be defined according the timestampdiff...
    better, you create a variable that contains the current date and then use it instead of current_timestamp in above formula...

    basic idea is to build the kind of above formula and then use it with your measurements...

    Hope this helps you...

  • BlackBerry Torch 9800 Smartphone delete messages of text more than 30 days

    And there is no option that AT & T or I can find to turn it off. How can I say this piece of * beep * phone ever delete my text messages? Facebook is the only application that I installed and I have more of 300 MB of application space and several GB of data storage space. I don't have that too this problem with SMS, emails, more than 30 days are still on my phone. What is going on?

    In fact, I found it finally, but your information is wrong. You must go to the menu options (different from texting) Messages. Then under 'Actions and the message', you go down and and change the "days to keep Messages" 30 days Forever. The fact that the default value of 30 days is inexcusable. BlackBerry R Dum

  • It is possible to look back in the history of more than 7 days?

    Is it possible t0 look back into history for more than 7 days?
    7 days is the default...

    Thank you for your comment.

    Jan

    Try this.

    • In the address bar, type Subject: config , and then click OK.
    • Copy and paste the following in the filter at the top: browser.history_expire_days to isolate this setting.
    • Presumably, he'll say '7' because that's all you can see. Then right-click and choose Edit from the menu, delete the figure who's there and replace it with 180
    • Then go to file | Exit, restart Firefox and do a little surfing accumulate a bit of history.

    Check back tomorrow to see if anything has changed.

  • How do you decommssion a domain controller that has not been on the network of more than 200 days?

    Hello

    in our society, we have an old domain controller has been disconnected for more than 200 days, probably in a State of thumbstone, it still appears in our network. We wanted to know what is the best way of disused this server, we connect to our network and do normal downgrade process.

    How do you decommssion a domain controller that has not been on the network of more than 200 days?

    Could you please write me back to my work email or call me on my work phone? Job information are below.

    Hello

    The business support, you can find forums on TechNet, see the following links:

    http://social.technet.Microsoft.com/forums/en/category/WindowsServer/

  • Why am getting started on the internet with the message saying that more than one computer using the same ip address

    am is started from the internet for 3 days pass with the message saying that more than one computer using the same ip address

    am is started from the internet for 3 days pass with the message saying that more than one computer using the same ip address

    Thatmessage normally means a another computer on your local network has the same IP as the computer you are on.

    You control your Local network?

Maybe you are looking for