Help with to_timestamp

  • From: Barbara Baker <barb.baker@xxxxxxxxx>
  • To: ORACLE-L <oracle-l@xxxxxxxxxxxxx>
  • Date: Tue, 19 May 2009 10:31:20 -0600

Hi, all.  Yep, I'm still alive and kicking.

I need to compute a month-to-date average for the column “average wait
time”.  The time has been populated in the warehouse as character, and
is in the format mm:ss

I want to do something along these lines
     to_char( (select avg(cci.WAIT_TIME) from OPS_MART.CIRCINFO cci
        where to_char(cci.CIRCDATE , 'YYMM') = to_char(cd.DASH_DATE -1 , 'YYMM')

but to do this, I need to first convert from character into something useful.

I tried to_timestamp, which gives me
    select circdate, to_timestamp(wait_time, 'mi:ss') from circinfo
       18-MAY-09  01-MAY-09 AM
Which I don’t find particularly useful.

Any ideas??

Thanks for any help!!

OPS_MART:REPDB>describe circinfo
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 CIRCDATE                                  NOT NULL DATE
 WAIT_TIME                                          VARCHAR2(5)

  1* select circdate, wait_time from circinfo order by circdate
01-MAY-09 00:53
02-MAY-09 00:23
. . . . . .
17-MAY-09 00:48
18-MAY-09 01:52

-Barb Baker
Denver Newspaper Agency
Office: 303-954-5384

Other related posts: