How to calculate the time interval
Dear Gururs,I have table of details of the calls as below
Call_Detail DESC;
Name of Type Null
--------- ---------- --------------
Appeal of VARCHAR2 (20)
VARCHAR2 (20) called
Time DATE
in other words table contains each call on a day like this
The call | Called | Time
========================================
A | B | January 1, 2011 00:02:00
A | B | January 1, 2011 00:08:00
A | B | January 1, 2011 00:18:00
A | B | January 1, 2011 00:22:00
A | B | January 1, 2011 00:30:00
A | B | January 1, 2011 00:31:00
I want output like below
The call | Called | Time | Time Difference (sec)
==============================================================
A | B | January 1, 2011 00:02:00 | 360
A | B | January 1, 2011 00:08:00 | 600
A | B | January 1, 2011 00:18:00 | 240
A | B | January 1, 2011 00:22:00 | 480
A | B | January 1, 2011 00:30:00 | 60
A | B | January 1, 2011 00:31:00 | 0
Could someone help to above.
Concerning
Sanjeev
Hello
Use the analytical fucntion of LEAD to get a value on the next line.
For example:
SELECT calling
, called
, NVL ( ( LEAD (time) OVER ( PARTITION BY calling
, called
ORDER BY time
)
- time
) * 24 * 60 * 60
, 0
) AS time_difference_sec
FROM call_detail
ORDER BY calling
, called
, time
;
If you would care to post CREATE TABLE and INSERT statements for your sample data, and then I could test this.
Published by: Frank Kulash, January 11, 2011 10:18
Tags: Database
Similar Questions
-
How to calculate the time to SELECT
I want to know how to calculate the time taken by the SELECT query.
For example: I run a select statement in TOAD (oracle version 9i) who takes 40 seconds to run, but in the output window, it displays few records. It says "list 1 of 500 records, more records exist". This table has total 20 million records.
Now my question is: have you my SELECT query took 40 seconds? or it took 40 seconds to SELECT 500 records.
If it took 40 seconds to SELECT 500 records then how to calculate the total amount?
Any help would be much appreciated.To avoid the exit which is probably not really need you can make
begin for c in (select * from xy /*your query */) loop null; end loop; end; /
This gives an estimate of the time to recover all the lines.
-
I want to calculate the time. I want to subtract ' 01:00:00 ' AM currently, but I am getting error.
SQL > /.
Select to_char('01:00:00','HH24:MI:SS')-to_char(sysdate,'HH24:MI:SS') double
*
ERROR on line 1:
ORA-01722: invalid number
can someone help me
Thank youNot sure what you mean. If you want to subtract an hour from a date, keep in date arithmetic spirit uses day as a unit. To subtract an hour from a date, you need to subtract 1/24:
SQL> alter session set nls_date_format = 'MM/DD/YYYY HH24:MI:SS' 2 / Session altered. SQL> select sysdate,sysdate - 1/24 from dual 2 / SYSDATE SYSDATE-1/24 ------------------- ------------------- 08/09/2009 09:55:28 08/09/2009 08:55:28 SQL>
SY.
-
QML: calculate the time interval between the touch events
I create a custom button that is activated by a key event, in this way:
Container { property bool pressed signal clicked... onTouch: { if (enabled && ! event.isMove()) { if (event.isUp() && pressed) clicked() pressed = event.isDown() } } }
The problem with this approach is that if the user clicks the custom button several times in a short period of time the click signal is triggered several times too. This does not happen if I use a regular button or an ImageButton.
I was thinking about getting the timestamp of the event and fire the only if clicked event grit touch after at least x milliseconds since the previous event. The DIF is that I couldn't find a way to calculate this difference in QML.
Any suggestions?
You could also follow the time of the last event with the Javascript date.
lastTouched = new Date().valueOf();
-Check if time has passed...
-
How to calculate the time difference
Hi friends,
I want to calculate and the sum of the time difference.
I have two fields in a table. Inside and OUTSIDE. for example.
OUT IN DIFFERENT
01:46 15:30?
01:47 15:45?
02:50 17:30?
I want less above figure and the result will appear in different column.
Help, please
Kind regards
Hello
Assuming that the two columns are the VARCHAR2 data type and "represent" the hours and minutes:
WITH sample_data AS (SELECT ' 01:46 ' in_col, 15:30 ' out_col FROM DUAL)
UNION ALL
SELECT ' 01:47 ' 15:45 ' OF THE DOUBLE
UNION ALL
SELECT ' 02:50 ', 17:30 ' OF THE DOUBLE
)
SELECT in_col,
out_col,
TO_CHAR (TO_DATE ((TO_DATE(out_col, 'HH24:MI')-TO_DATE(in_col, 'HH24:MI')) * 86400, «SSSSS»), "HH24") differ))
OF sample_data;
SQL > WITH sample_data AS (SELECT ' 01:46 ' in_col, 15:30 ' out_col FROM DUAL)
2. ANY TRADE UNION
3. SELECT ' 01:47 ' 15:45 ' OF THE DOUBLE
4 UNION ALL
5. SELECT ' 02:50 ', 17:30 ' OF THE DOUBLE
6 )
7. SELECT in_col,
out_col 8,.
9 to_char (TO_DATE ((TO_DATE(out_col, 'HH24:MI')-TO_DATE(in_col, 'HH24:MI')) * 86400, «SSSSS»), "HH24") differ))
10 FROM sample_data;
IN_COL OUT_COL DIFFER
------ ------- ------
01:46 15:30 13:44
01:47 15:45 13:58
02:50 17:30 14:40
SQL >
-
How to calculate the date interval
Hi Experts,
I'm looking for a way to calculate the interval between two dates. And get the result to the format "dd.mm.yyyy hh24:mi:ss.
Best practices for a problem like this?select sysdate - to_date('1.1.2000 12:00:00','dd.mm.yyyy hh24:mi:ss') from dual
Best regards
Igorselect trunc( months_between( day2, day1 ) / 12 ) years , mod( trunc( months_between( day2, day1 ) ), 12 ) months , numtodsinterval( day2 - add_months( day1, trunc( months_between( day2, day1 ) ) ), 'DAY' ) rest from ( select to_date( '19-01-1979', 'dd-mm-yyyy' ) day1, sysdate day2 from dual )
-
How to calculate the time difference in the two date columns time.
Hi Obiee Experts,
I came back new requirement on obiee 10g.
I have two date columns in my table time, data as below.
StartDate: 18/03/2012-04:40:51
Closing date: 18/03/2012-04:50:55
I want to the output as below (Jet lag).
output
04:40:51 (less)-04:50:55 = 00:10:04
I hope you understand my requirement in OBIEE.
Note: I want to show above the output values in another State for OBIEE10g column.
Please share me your valuable contributions. Urgent appeals.
Thank you
SatyaHi Satya,
Here's another solution. You can try the formula below as it is:
Cast (floor (TIMESTAMPDIFF (sql_tsi_second, '-SNP_SESSION '.))) SESS_BEG, '-SNP_SESSION '. SESS_END) / 3600) as char). ':' ||
Cast (floor (mod (TIMESTAMPDIFF (sql_tsi_second, '-SNP_SESSION '.)))) SESS_BEG, '-SNP_SESSION '. ((SESS_END), 3600) / 60) as char). ':' ||
Cast (mod (TIMESTAMPDIFF (sql_tsi_second, '-SNP_SESSION '.))) SESS_BEG, '-SNP_SESSION '. SESS_END), 60) as char)I would like to know if that's what you're looking for.
Thank you
-
calculate the time difference.
Hello
How to calculate the time difference by using javascript.
Example 15.05 and18.35 difference is 2 h 30 min
BTW: it isn't ~ 2h30min is 3h30min
Maybe something like this works:
// result is 3.300000000000002 ~ 3h 30min (parseFloat((18.35 - 15.05) / 3600) * 3600)
-
How to calculate the execution time of a SCTL in FPGA VI?
Hello
Can someone guide me that how to calculate the execution time of a SCTL for an iteration in the FPGA VI?
Thank you and best regards,
Rashid
Hello r,.
A SCTL will always run in a beat the clock it has been linked to. So, if you use a 40 MHz clock, this loop will run in 25 ns. If the code cannot complete in that, or if it requires two graduations of the watch to do the calculation, your code does not compile, then you have the guarantee that this will always be how long it takes this piece of code to run.
-
How to calculate the execution time of a loop?
Hello
Can someone guide me that how to calculate the execution time of a loop to iterate?
Thank you and best regards,
Rashid
I hope I have your question! See attached screenshot
-
How to calculate the loading time of BDB startup
Hi all
I understand that Berkeley DB at startup it will read a few pages from the disk in the memory cache, but I don't know the exact number of pages that will load. I think that BDB will load default pages as much as possible in the cache until the cache is full. Is this good?
And how to calculate the cost of time on the loading process? Can it be verified using db_stat?
Thank you very muchHello.
There is a discussion on how proceed (preload the cache) in this thread:
Re: a question about read file or cacheBen Schmeckpeper
-
How to calculate the difference in response times
Hello
I need to calculate the time difference of BI answers and I don't have access to the repository. I have the data in the following format
2005-10-12 19:24:19 12/10/2005 19:32:04
2005-10-12 19:50:47 2005-10-12 20:52:36
2005-10-12 19:54:23 04/11/2005 22:47:32
2005-10-12 21:05:51 12/10/2005 21:08:58
2005-10-12 21:07:42 12/10/2005 21:14:47
2005-10-12 21:09:02 12/10/2005 21:10:57
I need to get the hours of elapased between these two columns. Please help me
Thank youTimeStampDiff (SQL_TSI_HOUR, table.column1, table.column2)
-
How to calculate the ckptLogVolume?
Hello:
I have a question about control, our policy of ckeckpoint is 10 minutes or volume of data has come up to 1 G, but from the ckpthistory, we can see sometimes it does not respond to volume 10 minitues or 1 G. How to calculate the ckptLogVolume? If we see the result ckpthistory? If possible, which column? Thank you...
call ttCkptConfig;
< 600, 1024, 0 >
call ttckpthistory;
< 15:26:50.539519 2009-05-15, 2009-05-15 15:26:55.524454, fuzzy, completed, Checkpointer, < NULL >, 1, 99, 247909568, 82508, 4294967296, 81197, 1750236928, 15457, 301826504, 327339272, < NULL > >
< 15:17:20.577626 2009-05-15, 2009-05-15 15:17:20.857039, static, final, Subdaemon, < NULL >, 0, 97, 242211472, 81004, 4294967296, 79563, 1686897608, 20, 1573232, 1618112, < NULL > >
< 15:16:49.203124 2009-05-15, 2009-05-15 15:16:55.300502, static, final, Subdaemon, < NULL >, 1, 97, 242211320, 81004, 4294967296, 79563, 1686897608, 13070, 280099880, 239440672, < NULL > >
< 15:16:21.659487 2009-05-15, 2009-05-15 15:16:28.507656, static, final, Subdaemon, < NULL >, 0, 97, 242211168, 81004, 4294967296, 79563, 1686897608, 14441, 307440952, 265360008, < NULL > >
< 15:11:38.139007 2009-05-15, 2009-05-15 15:11:43.322764, fuzzy, completed, Checkpointer, < NULL >, 1, 96, 80730544, 81450, 4294967296, 80193, 1726321176, 14842, 308879240, 321674504, < NULL > >
< 15:08:18.118181 2009-05-15, 2009-05-15 15:08:23.100922, fuzzy, completed, Checkpointer, < NULL >, 0, 94, 79302232, 81558, 4294967296, 80382, 1737702968, 15017, 311253288, 334736648, < NULL > >
< 15:05:00.002139 2009-05-15, 2009-05-15 15:05:05.081461, fuzzy, completed, Checkpointer, < NULL >, 1, 92, 76043440, 81559, 4294967296, 80386, 1737962016, 15053, 311957568, 335301896, < NULL > >
< 15:01:41.882166 2009-05-15, 2009-05-15 15:01:46.959502, fuzzy, completed, Checkpointer, < NULL >, 0, 90, 74032552, 81594, 4294967296, 80425, 1740156304, 15008, 311831160, 337583368, < NULL > >Checkpopint operations which are drivern by the volume of interval and log checkpoint are those that are 'Checkpointer' in the output of ttCkptHistory. Control points can also occur for other reasons, for example when the data store is stopped, when it is loaded in memory and recovery is necessary. These kinds of control point are marked as "Static" and "Subdaemon". You can see three of those in the output.
The output, it seems you're checkpointing about every 4 minutes. Assuming the target settings (interval 600 seconds, Journal volume of 1 GB) were already in place at the time of these control points has occurred then it seems that all of these were led by the volume of the journal rather than the checkpoint interval (that you generate ~ 1 GB of log about every 4 minutes).
Chris
-
To build the waveform.vi function how to calculate the value of dt
Dear all
Please guide me How to calculate the value of dt according to waveform.vi of construction
My sampling rate is 25000 and I take 200000 samples.
Kind regards
Muhammad Irfan
It's all simple arithmetic. The inverse of the sampling frequency power of samples is then the dt or the time between samples the number of samples is not relevant.
-
How to view the "timer" current user time
Hello
How to display the "timer" right now?
Currently I have in my program using timer, how to display the current time left on the timer to warn the user the time left on the timer?
The number of timer upward or the countdown?
using TimerCB
a Council does
Thank you
Ben
I'm not aware of the possibility of obtaining the hour up to what a timer callback will be called, then I would say a different approach:
If, say, you want some action to happen every 10 minutes, but I would like to update the user interface of every second indicating the remaining time I would set the timer to 1 s interval. In the reminder of the timer, I would use a setting that is incremented each time the callback is called; If this value reaches 60 x 10 I reset the parameter and call the function to get the job done. In all other cases, you can simply view 600 - setting (in seconds) than the rest of the time.
An alternative may be to use two counters, one for the action, called every 10 minutes, and one for the update of the UI, called say every second...
Maybe you are looking for
-
Why can I not add music to the next place more?
This new update *. The feature that I found important on the old update has been removed, the possibility of creating a queue up next. I don't see why you could get rid of this ability. Explanations or something, I see no need to for? In addition, th
-
Adapter replacement necessary for Equium A300D
My original power supply Part No.: PA3468E packed in and I need a replacement. I have looked around, but only seem to be able to find 'Kensington' those but am afraid that they are not compatible as previous adptor didn't output 19V, 17V. Did someone
-
Pass the continuous problem N200
Hello I have build a systems that need constantly transmit packets containing only zeros and at certain time interval (for example every 2 seconds) pass a package valid ofdm. "" My problem is that the transmission vi ' niUSRP writing Tx Data "is too
-
Problem with Y550 Wireless: Wireless button does nothing
Got this Y550 (used), a few days ago. When I got there, the wifi worked well. Then it stopped working, I reinstalled Windows 7 (Lenovo recovery CD), then every time I turn on the wireless button, it just does nothing. No wifi signal, it's like a dumm
-
Acer Iconia tab upgrade 10 (A3 - A20)
I received a notification to upgrade my tablet, after the upgrade, it is still on KitKat, thought that it would be upgraded to lollipop as mentioned on: http://www.pcadvisor.co.uk/reviews/tablets/3601426/acer-iconia-tab-10-review/