SQL Language (MOSC)

MOSC Banner

calculate time from 2 timestamp column

edited Dec 31, 2014 10:25AM in SQL Language (MOSC) 3 commentsAnswered ✓

Hi,

From a table I need to calculate the total time taken by one  process.

How can I get the required output in one sql and required format.

any help will be appreciated.

SQL> desc batch_info

Name                                                                    Null?    Type

----------------------------------------------------------------------- -------- ------------------------------------------------

BATCH_ID                                              NOT NULL NUMBER

BATCH_APP_INFO                                                   VARCHAR2(50)

BATCH_DTTM                                                          TIMESTAMP(6)

START_DTTM                                                           TIMESTAMP(6)

END_DTTM                                                               TIMESTAMP(6)

BATCH_STATUS                                                       VARCHAR2(20)

the format should be

--------------------------------------------------------------

starting time   29-Dec-14 03:00:25 

ending time    29-Dec-14 05:33:20

Total time taken    2 hrs 32 min

so far I'm able to frame like this .....

================================

Select 'Starting Time :'|| to_char(start_dttm,'DD-Mon-YY HH:MI:SS') st,

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center