I have two rows stored in a table called client_booking. These are called start_time and end_time. I need to create a text box in ORACLE APEX which generates the elapsed time through an SQL query.
            Asked
            
        
        
            Active
            
        
            Viewed 454 times
        
    1 Answers
0
            Time difference being in days, let us multiply it by no of hours 24 and no of minutes 60. Assuming they are of DATE or TIMESTAMP datatypes
select (
         to_date('01-01-2014 '|| end_time  ||'00','DD-MM-YYYY HHMISS') -
         to_date('01-01-2014 '|| start_time||'00','DD-MM-YYYY HHMISS')
       ) * 24 * 60 as time_elapsed_in_mins
from your_table;
 
    
    
        Maheswaran Ravisankar
        
- 17,652
- 6
- 47
- 69
- 
                    -1 I'm confused by the `MAX()` and `MIN()` calls, because the OP said that the data is in the columns start_time and end_time – Erick Robertson Feb 20 '14 at 12:13
- 
                    @Erick I afraid OP meant it as 2 rows!! You can click the edit link in my answer too!! – Maheswaran Ravisankar Feb 20 '14 at 12:46
- 
                    I think he meant "columns", because I have a hard time believing he had two rows named start_time and end_time. :) – Erick Robertson Feb 20 '14 at 17:10
- 
                    apologies here. I did mean column not row, it's also worth mentioning the time is stored as '1130' not '11:30'. Thanks for the help – user2151140 Feb 20 '14 at 22:05
- 
                    @user2151140 just time you have ?I updated my answer.. I initially assumed it asxolumns, but after readingyour question, i changed.. – Maheswaran Ravisankar Feb 20 '14 at 22:11
 
    