SQL> SELECT TO_CHAR(start_time
2 , 'fmDy MM/DD/YYYY HH12:fmMI:SS AM') start_time
3 , TO_CHAR(end_time
4 , 'fmDy MM/DD/YYYY HH12:fmMI:SS AM') end_time
5 , DECODE(TRUNC(MONTHS_BETWEEN(end_time,start_time) / 12)
6 , 0, NULL
7 , 1, '1 year, '
8 , TRUNC(MONTHS_BETWEEN(end_time,start_time) / 12)
9 || ' years, ')
10 || DECODE(TRUNC(MOD(MONTHS_BETWEEN(end_time,start_time),12))
11 , 0, NULL
12 , 1, '1 month, '
13 , TRUNC(MOD(MONTHS_BETWEEN(end_time,start_time),12))
14 || ' months, ')
15 || DECODE(TRUNC(end_time) - ADD_MONTHS(TRUNC(start_time)
16 , TRUNC(MONTHS_BETWEEN(end_time
17 , start_time)))
18 , 0, NULL
19 , 1, '1 day, '
20 , TRUNC(end_time) - ADD_MONTHS(TRUNC(start_time)
21 , TRUNC(MONTHS_BETWEEN(end_time
22 , start_time)))
23 || ' days, ')
24 || DECODE(TRUNC(MOD(diff_in_secs / 60 / 60, 24))
25 , 0, NULL
26 , 1, '1 hour, '
27 , TRUNC(MOD(diff_in_secs / 60 / 60, 24))
28 || ' hours, ')
29 || DECODE(TRUNC(MOD(diff_in_secs / 60, 60))
30 , 0, NULL
31 , 1, '1 minute, '
32 , TRUNC(MOD(diff_in_secs / 60, 60))
33 || ' minutes, ')
34 || DECODE(ROUND(MOD(diff_in_secs, 60))
35 , 0, NULL
36 , 1, '1 second'
37 , ROUND(MOD(diff_in_secs, 60))
38 || ' seconds') real_time
39 FROM (SELECT start_time
40 , end_time
41 , ((end_time - start_time) * 24 * 60 * 60) diff_in_secs
42 FROM (SELECT TO_DATE('20000101'
43 , 'YYYYMMDD') start_time
44 , TO_DATE('20081230235959'
45 , 'YYYYMMDDHH24MISS') end_time
46 FROM DUAL))
47 /
START_TIME END_TIME REAL_TIME
------------------------ -------------------------- -------------------------------------------------------------
Sat 1/1/2000 12:00:00 AM Tue 12/30/2008 11:59:59 PM 8 years, 11 months, 29 days, 23 hours, 59 minutes, 59 seconds
SQL>
HTH,