Solved

Oracle: HBelp with basic query for evaluating a number pass/fail

Posted on 2013-06-05
9
467 Views
Last Modified: 2013-06-05
Hello Experts,

I am wanting to write a query that will evaluate the time difference between the time an alarm was presented to the time a ticket was created, (I have that part).   What I am need is to to evaluate the duration to see if it went over 5 minutes, if it did then "Fail", else "Pass".

The issue is that I wanting to evaluate it in a single case statement.  The reason is because I have other evalautions to write and don't want to nest select statments yet.

Here is what I have so far.
Evaluator.txt
0
Comment
Question by:Maliki Hassani
  • 4
  • 4
9 Comments
 
LVL 13

Assisted Solution

by:Alexander Eßer [Alex140181]
Alexander Eßer [Alex140181] earned 200 total points
ID: 39222269
select ....,
round((sysdate - to_date('29.08.2008 11:24:16', 'dd.mm.yyyy hh24:mi:ss')) * 86400) "seconds elapsed",
       trunc(mod((sysdate - to_date('29.08.2008 11:24:16', 'dd.mm.yyyy hh24:mi:ss')), 24)) || 'd ' ||
       trunc(mod((sysdate - to_date('29.08.2008 11:24:16', 'dd.mm.yyyy hh24:mi:ss')) * 24, 24)) || 'h ' ||
       trunc(mod((sysdate - to_date('29.08.2008 11:24:16', 'dd.mm.yyyy hh24:mi:ss')) * 24 * 60, 60)) || 'min ' ||
       trunc(mod((sysdate - to_date('29.08.2008 11:24:16', 'dd.mm.yyyy hh24:mi:ss')) * 24 * 60 * 60, 60)) || 'sec' "time elapsed"
from ....

Open in new window

0
 
LVL 13

Expert Comment

by:Alexander Eßer [Alex140181]
ID: 39222277
substitute "sysdate" with "ALARM_DATE" and "to_date('29.08.2008 11:24:16', 'dd.mm.yyyy hh24:mi:ss')" with TICKET_CREATE_DATE
0
 

Author Comment

by:Maliki Hassani
ID: 39222285
Let me give this a try.. Thanks
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:Maliki Hassani
ID: 39222301
I appreciate the code, but my query gives me the minutes correctly.  I am looking to have it evalaute it the 5 minutes and produce the results as Pass or fail.
0
 
LVL 48

Accepted Solution

by:
PortletPaul earned 300 total points
ID: 39222342
select --....,
  round((sysdate - to_date('29.08.2008 11:24:16', 'dd.mm.yyyy hh24:mi:ss')) * 86400) "seconds elapsed"
, case when round((sysdate - to_date('29.08.2008 11:24:16', 'dd.mm.yyyy hh24:mi:ss')) * 86400) > (5*60) then 'Fail' else 'Pass' end min_5_test
, trunc(mod((sysdate - to_date('29.08.2008 11:24:16', 'dd.mm.yyyy hh24:mi:ss')), 24)) || 'd ' ||
  trunc(mod((sysdate - to_date('29.08.2008 11:24:16', 'dd.mm.yyyy hh24:mi:ss')) * 24, 24)) || 'h ' ||
  trunc(mod((sysdate - to_date('29.08.2008 11:24:16', 'dd.mm.yyyy hh24:mi:ss')) * 24 * 60, 60)) || 'min ' ||
  trunc(mod((sysdate - to_date('29.08.2008 11:24:16', 'dd.mm.yyyy hh24:mi:ss')) * 24 * 60 * 60, 60)) || 'sec' "time elapsed"
from dual --....

Open in new window

0
 

Author Comment

by:Maliki Hassani
ID: 39222350
Trying now, thanks
0
 
LVL 13

Expert Comment

by:Alexander Eßer [Alex140181]
ID: 39222365
but my query gives me the minutes correctly.  I am looking to have it evalaute it the 5 minutes and produce the results as Pass or fail.

I don't get that, please explain again ;-)
0
 
LVL 13

Expert Comment

by:Alexander Eßer [Alex140181]
ID: 39222379
ignore my last post, didn't read PortletPaul's response...
0
 

Author Closing Comment

by:Maliki Hassani
ID: 39222484
Thank you!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Read about achieving the basic levels of HRIS security in the workplace.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question