Check, through periods of time between the rows
Hello
I have the problem by creating a select to check between crossing periods of time.
It comes to my table
CREATE TABLE 'T_PLAN '.
(NUMBER OF 'TRAIN_NO',
VARCHAR2 (5) "TIME_FROM."
VARCHAR2 (5) "TIME_UNTIL."
NUMBER OF 'RAIL_NO '.
) ;
TRAIN_NO TIME_FROM TIME_UNTIL RAIL_NO
172 07:06 15:50 1
120 07:33 15:41 2
229 07:56 14:52 3
217 15:05 18:47 1
189 16:10 19:53 2
185 16:10 19:53 3
181 20:10 23:53 2
29: 14 142 23:32 3
I want to check if my train number 172 crosses another line with the same RAIL_NO.
In this case train number 217 hits the same time period as the fact of 172. Car: 15:05 < = 15:50
The output that I need:
TRAIN_NO TIME_FROM TIME_UNTIL RAIL_NO CHECK_ROW
172 07:06 15:50 1 INVALID
120 07:33 15:41 2 VALID
229 07:56 14:52 3 VALID
217 15:05 18:47 1 INVALID
189 16:10 19:53 2 VALID
185 16:10 19:53 3 VALID
181 20:10 23:53 2 VALID
142 20:14 23:32 3 VALID
Thank you for your support.
Tobias has soon
Hello
Here's one way:
SELECT DISTINCT
d.
NVL2 (o.rail_no
, '-INVALID' or "UNVALID", if you really want that
"VALID".
) AS check_row
OF t_plan d
LEFT OUTER JOIN t_plan o ON o.rail_no = d.rail_no
AND o.time_from<=>=>
AND o.time_until > = d.time_from
ORDER BY d.time_from;
If you would care to see instructions INSERT for your sample data, then I could test this.
Two ranges overlap if (and only if) everyone will start before the other ends one. It will be clearer if we consider two ranges do not overlap if (and only if) one of them begins after the end of the other.
This solution assumes that time_from<= time_until="" on="" every="" row. ="" is="" that="" true? ="" for="" example,="" if="" a="" rail="" is="" in="" use="" at="" midnight,="" could="" you="" have="" (for="" example)="" time_from='23:55' and="" time_intil='00:05' on="" the="" same="">=>
Tags: Database
Similar Questions
-
What is the interval of time between the virtual machine Linux and ESXi host synchronization?
I have ESX5.0 with a centos6 installed on this linux virtual machine.
After the installation of vmware for Linux virtual machine tools, I activated the time synchronization between the virtual machine linux and ESXi host through vmware-toolbox-cmd.
I wonder what is the interval of time between the virtual machine linux and ESXi host synchronization? If I quickly time OS system, when the OS system time will sync back to the ESXi host?
According to http://www.vmware.com/files/pdf/techpaper/Timekeeping-In-VirtualMachines.pdf:
By default, the demon checks the guest only once per minute operating system clock.
However, depending on whether the guest is behind or in front of the result is different. So, please read the section "periodic synchronization" (at least) in the document mentioned above.
André
-
I have a sine wave of 50 Hz and a pulse of the signal on the same chart. The difference in phase between the two is between 0-90 degrees.
Now I need to calculate the time difference between (when the sinusoidal wave passes through zero volts) and (when the pulse increases). The frequency will remain about even for the two signals.
The request is for a three-phase generator. In simple terms, when the difference in time between the passage to zero of the sine wave and pulse increases increases, it means that the load on the generator has increased.
I am a novice user of LabView (version 9, 2009), maybe it's a very simple problem but I was pulling on my hair for the past few days and couldn't understand anything. Any help would be greatly appreciated. I use DAQ USB-6008 to measure these tensions and the impulse of the generator and a sensor
I have attached a jpg file (a graphic that I just did with excel to explain). The time 't' is what I'm trying to measure
See you soon
Zdzislaw
Awais.h,
For problems of this kind I recommend start writing the granular steps you would take to manually fix this problem. You can't say LabVIEW (or any programming language) If you can't succinctly describe the solution to your problem.
The I want to address this problem is to:
- find all the zero crossing points and edges on the rise
- for every rising edge find the difference between the timestamp and previous passage by zero
Here is an implementation of this algorithm LabVIEW:
-
Cannot get rid of the gaps between the rows in the table with the basic HTML in DW cc 2015
Hi gang
I haven't used html in ages and doing something basic without css... but for some reason any I get these gaps between the rows in the table, no cause I do.
what I am doing wrong?
< ! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 / / IN" "http://www.w3.org/TR/html4/strict.dtd" > ""
< html >
< head >
< meta http-equiv = "Content-Type" content = text/html"; Charset = UTF-8 ">"
< title > Untitled Document < /title >
< / head >
< body >
< table width = "560" >
< /table >
< table width = "560" border = "0" align = "center" cellpadding = "0" cellspacing = "0" >
< tbody >
< b >
< td colspan = "3" > < img src = "images/AAA - ADE_01.jpg" width = "560" > < table >
< b >
< td width = "209" > < img src = "images/AAA - ADE_02.jpg" height = "267" / > < table >
< td width = "158" > < img src = "images/AAA - ADE_03.jpg" height = "267" / > < table >
< td width = "193" > < img src = "images/AAA - ADE_04.jpg" height = "267" / > < table >
< b >
< td width = "209" > < img src = "images/AAA - ADE_05.jpg" height = "267" / > < table >
< td width = "158" > < img src = "images/AAA - ADE_06.jpg" height = "267" / > < table >
< td width = "193" > < img src = "images/AAA - ADE_07.jpg" height = "267" / > < table >
< b >
< td width = "209" > < img src = "images/AAA - ADE_05.jpg" height = "267" / > < table >
< td width = "158" > < img src = "images/AAA - ADE_06.jpg" height = "267" / > < table >
< td width = "193" > < img src = "images/AAA - ADE_07.jpg" height = "267" / > < table >
< b >
< td width = "209" > < img src = "images/AAA - ADE_08.jpg" height = "267" / > < table >
< td width = "158" > < img src = "images/AAA - ADE_09.jpg" height = "267" / > < table >
< td width = "193" > < img src = "images/AAA - ADE_10.jpg" height = "267" / > < table >
< b >
< td width = "209" > < img src = "images/AAA - ADE_11.jpg" height = "267" / > < table >
< td width = "158" > < img src = "images/AAA - ADE_12.jpg" height = "267" / > < table >
< td width = "193" > < img src = "images/AAA - ADE_13.jpg" height = "267" / > < table >
< b >
< td width = "209" > < img src = "images/AAA - ADE_14.jpg" height = "267" / > < table >
< td width = "158" > < img src = "images/AAA - ADE_15.jpg" height = "267" / > < table >
< td width = "193" > < img src = "images/AAA - ADE_16.jpg" height = "267" / > < table >
< b >
< td width = "209" > < img src = "images/AAA - ADE_17.jpg" height = "267" / > < table >
< td width = "158" > < img src = "images/AAA - ADE_18.jpg" height = "267" / > < table >
< td width = "193" > < img src = "images/AAA - ADE_19.jpg" height = "267" / > < table >
< b >
< td width = "209" > < img src = "images/AAA - ADE_20.jpg" height = "267" / > < table >
< td width = "158" > < img src = "images/AAA - ADE_21.jpg" height = "267" / > < table >
< td width = "193" > < img src = "images/AAA - ADE_22.jpg" height = "267" / > < table >
< /tr >
< / tbody >
< /table >
< / body >
< / html >
Add this in the
section of your pagetable {
border-collapse: collapse;
}
img {
vertical-align: middle;
}
-
Calculate the elapsed time between the horodateurs log Table
Hello
I'm looking for some codes SQL allows to calculate the elapsed time between the timestamps in a log table. The log table has some STOP-START operations.
I just want to calculate the elapsed time between the START and PAUSE of Transactions, as well as START and EXECUTE transactions.
So, in the example below, the time spent must be:
START 09:15 break 09:20 (5 Minutes)
START 09:30 to 09:45 (15 Minutes) FULLTotal elapsed time for LOG_ID 1234 should be 20 minutes. This excludes the 09:20 at 09:30 BREAK at the START time.
LOG_ID
SEQ_NUM
LOG_TYPE_CD
CRE_DTTM
1234
1
BEGINNING
09-15 - 2013:09:15:00
1234
2
BREAK
09-15 - 2013:09:20:00
1234
3
BEGINNING
09-15 - 2013:09:30:00
1234
4
ALL THE
09-15 - 2013:09:45:00
Any suggestions?
Thanks for your time
-DT
Hello
Thanks for posting the CREATE TABLE and INSERT. be sure to post the results desired from these data.
user13071913 wrote:
Hi thanks for the help...
The date is a true timestamp. ...
Here's a sample of CREATE TABLE and a few inserts. 3 ID transaction, each with a series of journal entries.
CREATE TABLE 'LOG_TABLE_X '.
(SELECT 'ID' CHAR (14 BYTES) NOT NULL,)
ACTIVATE THE "LOG_TYPE_FLG" TANK (4 BYTES) NOT NULL,
ALLOW "LOG_DTTM" DATE NOT NULL
);
...
I'm so confused. Is log_dttm a TIMESTAMP, you said in the story, or is it a DATE, as you say in the CREATE TABLE statement, or is it a VARCHAR2 as Thur INSERT statements? I'll assume it's a DATE.
I left out an important step yesterday. The computation of the last_start, we need to use a CASE statement so that we record only the time of events STRT.
Here's the revised query:
WITH got_last_start AS
(
SELECT id, log_type_flg, log_dttm
LAST_VALUE (CASE
WHEN log_type_flg = "STRT".
THEN log_dttm
END
IGNORES NULL VALUES
) OVER (PARTITION BY id - can - be
ORDER BY log_dttm
) AS last_start
OF log_table_x
)
SELECT id, log_type_flg, log_dttm
, (log_dttm - last_start) * 24 * 60 elapsed
, SUM (log_dttm - last_start) OVER (PARTITION BY ID.
ORDER BY log_dttm
) * 24 * 60 AS total_elapsed
OF got_last_start
WHERE log_type_flg IN ("CMPT", "PAUS")
ORDER BY id, log_dttm
;
Output of your sample data:
ID LOG_ ELAPSED TOTAL_ELAPSED LOG_DTTM
-------------- ---- ------------------- -------- -------------
1111 PAUS 09-26 - 2013:09:09:58.17.17
1111 CMPT 09-26 - 2013:10:09:58 1.00.83
2222 CMPT 09-26 - 2013:12:09:58 180.00 180.00
3333 CMPT 09-26 - 2013:10:09:42 59.73 59.73
In Oracle, when you subtract one DATE from another DATE, the result is the NUMBER of days between them. In the above query, I multiplied the past columns and total_elapsed by the number of minutes per day (24 * 60), to show the time in minutes.
-
Measure the time between the ridges of the periodic input signal
We have built a circuit which is supposed to mimic an Exercycle. We have an IR switch and a spinning wheel, the rccb meets a comparator circuit and the output of the element of comparison, we have running in LabView. We successfully were able to measure the number of rotations of the wheel and the total distance travelled by the wheel, but are struggling to measure speed. We cannot find a way to measure the time between picks in real time, which we could then divide the wheel circumference and calculate the speed in real time. The VI I posted has a square wave simulated rather than the signal we receive on our circuit. Thanks in advance for the help.
Jon and David
I think you're overloading the things trying to get the time between two pulses. Instead, you can use the VI Express your measures and select frequency for her custom. Then, you can multiply the circumference of the wheel of the frequency to get the speed.
I hope this helps.
-Christina
-
Win 7 64 bit
AMD hd 6870 connected via HDMI pn59d500 samsung plasma tv
What is going on:
If I am reading an article or by typing in a comment like this box, the screen turns off after a certain period of time.
-mouse mobile, typing, scrolling window or motion/movement of the window (like firefox) on the desktop does not work for normal brightness screen.
-resizing of the window will be brighten screen (also by clicking on the Start button or start another application or similar activities).
What I've done and additional info:
-My hdtv eco settings and and autobrightness are all off. I don't have the problem with other components related to this view. This is not the problem of the screen
-my desktop pc power settings are not set to reduce brightness at any time. I even disabled the «turn off the display after...» "option. Anyway, same problem. I have the computer put to sleep after 20 minutes.
-a ran the troubleshooting of windows power - I know how to click and read. There is nothing outside of the obvious and already known.
As-i crossed all the parameters of the CCC (the suite software amd vid card). the only color/quality setting I use is deinterlacing with drop-down auto-detection. pixel format is set to RGB 4:4:4 limited. I have active treatment of ITC (will try not disabled, no idea what it affects). I use manual detection of displays... no setting under "desktop management", "my digital flat screens", and "video" seems to do anythign with dimming screen.
I read through the first 5 pages of the "Sun Office" search results here... no related response.
just thought to google the registry entries related to power... but always options this issue. I'll look into registry changes after.
Hello
Please update us on the issue. Office is different from the laptop, and because the screen is dimming as it does in a laptop, it is related to the power settings or the driver itself. These are the only two things that are responsible for the same in a laptop as well.
Therefore, I recommend you try to create a new power plan or change the existing one to check. You can also refer to:
http://Windows.Microsoft.com/en-us/Windows7/change-create-or-delete-a-power-plan-scheme
Let us know the results when you try these methods.
Thank you
-
6602 OR time between the redeclenchables task runs
I'm trying to use a signal level TTL of a device to trigger a train of impulses of the 6602 OR. I have no problem getting the 1st pulse train, but the subsequent pulse trains are delayed and no longer synchronize with new incoming TTL signals. I've tested this with trains of pulses consisting of a pulse with no luck. Is there an interval over time required by a redeclenchables task to "recharge"?
It might be interesting to note that the initiator of the TTL trigger product the trigger as a 5V increase 0 and can access more than 0.7mA.
Vadim
Hi Vadim,
The trigger must be re-army in a time base tick or two (12, 5-25 ns if you use the time base of 80 MHz) when the previous impulse over, so this probably isn't the issue.
I expect that you run into is a characteristic of DAQmx how treats the initial delay property for redeclenchables meter tasks. You can find a description here, but essentially the behavior is to generate a single pulse redeclenchables:
First start: will stay in a State of rest for the Initial delay, then generate a single pulse of time to the high.
All of the following triggers: will be remain in a State of rest for the period, and then generate a single pulse of the desired length of top.
This is true for most of the DAQ hardware. Recent material (series X, other than the 9172 cDAQ chassis) actually use the behavior waited more than use the initial delay instead some time on each retrigger (with the possibility to go back to the old behavior by setting a property). On your 6602, my recommendation when generating a single pulse redeclenchables is always set your low time equal to the initial period (the minimum value would be 25 ns).
Best regards
-
Hello
I'm trying to measure the time in seconds between each two successive rising edges on a digital input.
So far I managed to detect the rising edge, increment a counter at each rising edge and take the time during which the increase is edge
all I need now is subtract edge currently rising from the previous era of edge rising to calculate (T), which can be 1/frequency and display in real time for the user.
but I do not know how to do this
Can someone help me please!
Note: while I am in a position varies between 200 ms - 2 seconds
-
Differences in time between the SD card and the pictures folder.
Every time I have to import pictures from a card SD of my camera in my images folder, the properties in the image file is a compatible 1 hour less than on the SD card. And when I open the file photos with picture Windows, time Gallery constantly advance before time assimilating as well as on the SD card (withdrawn). Why?
All the images in the photo folder reflect this incorrect time information regardless of when they were taken (summer time vs non - DST).
Thank you. My camera and Windows Photo Gallery offer the same and exact time. When you move a camera image in a file of photos on my PC, the time adjusts backwards by one hour. I don't understand how this can be a function of camera setting. A more reasonable response was delivered by one of your colleagues at the: http://msdn.microsoft.com/en-us/library/windows/desktop/ms724290(v=vs.85).aspx
But thank you.
=======================================
My thought was that maybe the time in the camera
before the DST change which would have
account of the gap of 1 h. If it's wrong in
this instance... so be.Excuse me for life.
-
Differences in time between the start date and end Date
I have a requirement to get the difference between the two dates, I am on the syntax below to fill, but it does not work. The syntax is the following:
TimestampDiff (SQL_TSI_MONTH, "[< dStart_Date_ITAG >]", '[< dEnd_Date_ITAG >]'). Could you please help me on this. Thanks in advance
OlivierHello Roytson,
I want to enjoy the sytem itself, I mean there are 2 custom fields start date and enddate, my function should take system only do not enter manually.
could you please develop this thing. -
SQl query to find out time between the different lines of transactions
(See both images from an attachment to get the clear picture of the data and understand the question correctly.)
I have a set of data like this in one of my paintings. (This is a simple representation of the original data.)
Reference table1.jpg
Id | Type | Value | Start_date | End_date
----------------------------------------------------------------------------------------------------------------------
ZTR0098 | ALLOW | 0 | 1 JUN | 2 JUN |
ZTR0098 | ADTAX | 0 | 1 JUN | 2 JUN |
ZTR0098 | MXTAX | 0 | 1 JUN | 9 JUN |
ZTR0098 | ALLOW | 4. 3 JUN | 15 JUN |
ZTR0098 | ADTAX | 44.00 | 3 JUN | 17-JUNE |
ZTR0098 | MXTAX | 2. 10 JUN | 17-JUNE |
ZTR0098 | ALLOW | 5. 16-JUNE | 20 JUN |
ZTR0098 | ADTAX | 55,34 | 18 JUN | 22 JUN |
ZTR0098 | MXTAX | 1. 18 JUN | 25 JUN |
ZTR0098 | MXTAX | 6. 26 JUN | 31 AUG |
ZTR0098 | ADTAX | 20.09. 23 JUN | 23 JUL |
ZTR0098 | ALLOW | 8. 21 JUN | 31 AUG |
ZTR0098 | ADTAX | 45. 24 JUL | 31 AUG |
each line has a type and a rasthaus id to it. ID belongs to other parent tables. the value of each type is given, and the validity of each value is followed by a field start_date and end_date.
All values start from 1 - JUN and expires on 31 - AUG. Now my requirement is to obtain a report that gives three columns for three different types (ALLOW, ADTAX and MXTAX) with combination of unique values in the effective time interval. Let me put the result below.
Reference table2.jpg
Id | ALLOW | ADTAX | MXTAX | Start_date | End_date
--------------------------------------------------------------------------------------------------------------------------------------------------
ZTR0098 | 0 | 0 | 0 | 1 JUN | 2 JUN |
ZTR0098 | 4. 44.00 | 0 | 3 JUN | 9 JUN |
ZTR0098 | 4. 44.00 | 2. 10 JUN | 15 JUN |
ZTR0098 | 5. 44.00 | 2. 16-JUNE | 17-JUNE |
ZTR0098 | 5. 55,34 | 1. 18 JUN | 20 JUN |
ZTR0098 | 8. 55,34 | 1. 21 JUN | 22 JUN |
ZTR0098 | 8. 20.09. 1. 23 JUN | 25 JUN |
ZTR0098 | 8. 20.09. 6. 26 JUN | 23 JUL |
ZTR0098 | 8. 45. 6. 23 JUL | 31 AUG |
As you can see there are no duplicate rows for a combination of (ALLOW, ADTAX and MXTAX) with their respective dates in force. resulting in the above table. the first step is to convert lines to the column which is pretty obvious to do that by grouping on start_date and end_date colum, but the real deal is the time interval during which the combination of the values (ALLOW, ADTAX, and MXTAX) has remained constant.
I wrote under query using Group by.
Select
ID,
NVL (max (decode (type, "ALLOW", value)), 0) as ALLOW
NVL (max (decode (type, 'ADTAX', value)), 0) as ADTAX
NVL (max (decode (type, 'MXTAX', value)), 0) as MXTAX
Start_date,
End_date
from my_table
Group of start_date, end_date, id
start_date, end_date
the results it gives are like this:
Reference table3.jpg
Id | ALLOW | ADTAX | MXTAX | Start_date | End_date
------------------------------------------------------------------------------------------------------------------------------------------------
ZTR0098 | 0 | 0 | 0 | 1 JUN | 2 JUN |
ZTR0098 | 0 | 0 | 2. 1 JUN | 9 JUN |
ZTR0098 | 4. 0 | 0 | 3 JUN | 15 JUN |
ZTR0098 | 0 | 44.00 | 0 | 3 JUN | 17-JUNE |
ZTR0098 | 0 | 0 | 2. 10 JUN | 17-JUNE |
ZTR0098 | 5. 0 | 0 | 16-JUNE | 20 JUN |
ZTR0098 | 0 | 55,34 | 0 | 18 JUN | 22 JUN |
. .
. .
like wise
but I'm not able to determine the time intervals by using the SQL query.
with
Table1 as
(select the id 'ZTR0098', 'ALLOW' type, 0 val, to_date('1-JUN','dd-MON') start_date, end_date Union to_date('2-JUN','dd-MON') double all the)
Select 'ZTR0098', 'ADTAX', 0, to_date('1-JUN','dd-MON'), to_date('2-JUN','dd-MON') of all the double union
Select 'ZTR0098', 'MXTAX', 0, to_date('1-JUN','dd-MON'), to_date('9-JUN','dd-MON') of all the double union
Select 'ZTR0098', 'ALLOW', 4, to_date('3-JUN','dd-MON'), to_date('15-JUN','dd-MON') of all the double union
Select 'ZTR0098', 'ADTAX', 44.00, to_date('3-JUN','dd-MON'), to_date('17-JUN','dd-MON') of all the double union
Select 'ZTR0098', 'MXTAX', 2, to_date('10-JUN','dd-MON'), to_date('17-JUN','dd-MON') of all the double union
Select 'ZTR0098', 'ALLOW', 5, to_date('16-JUN','dd-MON'), to_date('20-JUN','dd-MON') of all the double union
Select 'ZTR0098', 'ADTAX', 55.34, to_date('18-JUN','dd-MON'), to_date('22-JUN','dd-MON') of all the double union
Select 'ZTR0098', 'MXTAX', 1, to_date('18-JUN','dd-MON'), to_date('25-JUN','dd-MON') of all the double union
Select 'ZTR0098', 'MXTAX', 6, to_date('26-JUN','dd-MON'), to_date('31-AUG','dd-MON') of all the double union
Select 'ZTR0098', 'ADTAX', 20.09, to_date('23-JUN','dd-MON'), to_date('23-JUL','dd-MON') of all the double union
Select 'ZTR0098', 'ALLOW', 8, to_date('21-JUN','dd-MON'), to_date('31-AUG','dd-MON') of all the double union
Select 'ZTR0098', 'ADTAX', 45, to_date('24-JUL','dd-MON'), to_date('31-AUG','dd-MON') of the double
),
days like
(select level - 1 dte + to_date('1-JUN','dd-MON')
of the double
connect by level<= to_date('31-aug','dd-mon')="" -="" to_date('1-jun','dd-mon')="" +="">=>
)
Select id, allow, adtax, mxtax, min (dte) start_date, max (dte) end_date
(select ID, dte, max (allow) allow, max (adtax) adtax, max (mxtax) mxtax,
ROW_NUMBER() over (order by dte) row_number() - courses (partition by order max (allow), max (adtax), max (mxtax) by dte) gr
go (select id, dte,
-case when type = 'ALLOW' and dte between start_date and end_date then end val 0 otherwise allow.
-case when type = "ADTAX" and dte between start_date and end_date then val 0 otherwise end adtax.
-case when type = "MXTAX" and dte between start_date and end_date then val 0 otherwise end mxtax
Table 1 t,
days d
where d.dte between t.start_date and t.end_date
)
Group by id, dte
)
Group by id, gr, allow, adtax, mxtax
order by id, gr
ID ALLOW ADTAX MXTAX START_DATE END_DATE ZTR0098 0 0 0 01/06/2015 02/06/2015 ZTR0098 4 44 0 03/06/2015 09/06/2015 ZTR0098 4 44 2 10/06/2015 15/06/2015 ZTR0098 5 44 2 16/06/2015 17/06/2015 ZTR0098 5 55,34 1 18/06/2015 20/06/2015 ZTR0098 8 55,34 1 21/06/2015 22/06/2015 ZTR0098 8 20.09 1 23/06/2015 25/06/2015 ZTR0098 8 20.09 6 26/06/2015 23/07/2015 ZTR0098 8 45 6 24/07/2015 31/08/2015 Concerning
Etbin
-
time between the start and end
I have reservation with 4 columns of table
start end id room
20.10.2011 09:00 20.10.2011 12:00 1 100
How can I get the following result
time room id
09:00 1 100
09:30 1 100
10:00 1 100
10:30 1 100
11:00 1 100
11:30 1 100
12:00 1 100
can someone help me?It should work
WITH t AS ( SELECT TO_DATE ('20-Oct-2011 09:00','dd-mon-yyyy hh24:mi') start_date_time, TO_DATE ('21-Oct-2011 11:30','dd-mon-yyyy hh24:mi') end_date_time, 1 id, 100 room FROM DUAL UNION ALL SELECT TO_DATE ('20-Oct-2011 09:00','dd-mon-yyyy hh24:mi') start_date_time, TO_DATE ('21-Oct-2011 11:00','dd-mon-yyyy hh24:mi') end_date_time, 2 id, 200 room FROM DUAL ) SELECT TO_CHAR(start_date_time + (column_value-1)*(1/(24*2)),'dd-mon-yyyy') start_dt, TO_CHAR(start_date_time + (column_value-1)*(1/(24*2)),'hh24:mi') start_time, id, room FROM t, table( cast( multiset( select level from dual connect by level <= ((end_date_time - start_date_time)*24*2) + 1 ) as sys.OdciNumberList ) );
Test case with the smaller date range
WITH t AS ( SELECT TO_DATE ('20-Oct-2011 09:00','dd-mon-yyyy hh24:mi') start_date_time, TO_DATE ('20-Oct-2011 11:30','dd-mon-yyyy hh24:mi') end_date_time, 1 id, 100 room FROM DUAL UNION ALL SELECT TO_DATE ('20-Oct-2011 09:00','dd-mon-yyyy hh24:mi') start_date_time, TO_DATE ('20-Oct-2011 10:30','dd-mon-yyyy hh24:mi') end_date_time, 2 id, 200 room FROM DUAL ) SELECT TO_CHAR(start_date_time + (column_value-1)*(1/(24*2)),'dd-mon-yyyy') start_dt, TO_CHAR(start_date_time + (column_value-1)*(1/(24*2)),'hh24:mi') start_time, id, room FROM t, table( cast( multiset( select level from dual connect by level <= ((end_date_time - start_date_time)*24*2) + 1 ) as sys.OdciNumberList ) ); START_DT START_TIME ID ROOM ----------------- ---------- ---------------------- ---------------------- 20-oct-2011 09:00 1 100 20-oct-2011 09:30 1 100 20-oct-2011 10:00 1 100 20-oct-2011 10:30 1 100 20-oct-2011 11:00 1 100 20-oct-2011 11:30 1 100 20-oct-2011 09:00 2 200 20-oct-2011 09:30 2 200 20-oct-2011 10:00 2 200 20-oct-2011 10:30 2 200 10 rows selected
Thanks to Solomon Yakobson to its solution on thread:
I found the solution from there.
-
Find the elapsed time between the Unix Timestamp in Actionscript 2.0
Hello!
I'm tryin to fiind that time passed since a Unix Timestamp.
I have this:
var myTime:Date = new Date(1245859691 * 1000); nowTime = new Date(); oMillisElapsed = new Date(nowTime - myTime); day = numToStr(oMillisElapsed.getDate()); min = numToStr(oMillisElapsed.getMinutes()); sec = numToStr(oMillisElapsed.getSeconds()); hour = numToStr(oMillisElapsed.getHours());
But oMillisElapsed returns: Wed Dec 31 23:20:43 GMT - 0800 1969
So he keeps time from 01/01/1970... Any way to make it back to something like this:
Mon Jan 02 01 1:2:35 GMT - 0800 0000
or something like that so I can get the days, hours, minutes and seconds.
I use actionscript 2.0.
Thank you!!!
~ Sea4Me
You assign a new Date value, so when you try to use the Date function to get its data, you get that produce these functions, which isn't what I want. I believe you want to get the amount of time (days, hours, minutes, etc.) between yesterday and today. Have you tried to do what I suggested? What you will eventually do takes the miiliseconds resulting from that and do the conversion in days, hours, seconds, etc...
-
find the interval of time between the generation of logs archives of v$ log_history
Hi all:
I want to find the interval of generation of newspaper archives of v$ log_history,.
SEQUENCE # FIRST_TIME
11349 10/17/2009 12:08:58 AM
11350 10/17/2009 12:13:10 AM
11351 10/17/2009 12:15:46 AM
11352 10/17/2009 12:18:32 AM
11353 10/17/2009 12:21:32 AM
11354 10/17/2009 12:23:06 AM
11355 10/17/2009 12:24:59 AM
11356 10/17/2009 12:26:10 AM
11357 10/17/2009 12:27:18 AM
11358 10/17/2009 12:34:34 AM
11359 10/17/2009 12:37:43 AM
11360 10/17/2009 12:48:36 AM
11361 10/17/2009 12:52:10 AM
Add a column to display the time difference (in minutes) between 11350 and 11349. It is actually 5 minutes, even between 11351 and 11350 nearly 2 minutes.
Kind regards
Hassanselect sequence#, to_char(first_time, 'DD/MM/YYYY HH:MI:SS AM'), (first_time - lag(first_time) over (order by first_time)) * (24*60) as mins from v$log_history
Maybe you are looking for
-
During sleep and various panic kernel panic / restarts
Hello world I got an iMac 27-inch end of 2013 with an nVidia card and maximum 32 GB of RAM running El Capitan, and I had a few kernel panic/restart issues lately. It's not happened to me in some time, but this last kernel panic occurred while the mac
-
Apple music showing "unauthorized content" when you try to play songs
Ive used the streaming service for 6 months on the same device with the same Apple ID. Today when I tried to play songs in my title the same error popped up when I tried to play any song (so not an issue explicit lyrics). I tried to sign in and out
-
I bought XP computer a few years ago. Recently, I installed Linux on it when I bought another computer with W8Pro. When I went back to XP instead of Linux, my key number worked, but difficulties have emerged with the installation of the updates. They
-
Re-install Windows 7 and Microsoft Office 2007 to keep
I have an Alienware m15x, I bought from Dell in 2009. I customized my order when I bought, so it came with Microsoft Office pre-installed. The summer is slow and I got diverted by some viruses adware because of my carelessness, so rather than underst
-
Printer for Windows 7 64-bit compatibility
Can someone please help me find a printer/scanner of consumer that are compatible with the Windows 7 64-bit operating system? I can't locate the enteprises of printer that supports the 64 bit OS? How is that possible? Why would you do this OS and can