Unix Technical Forum

Seconds

This is a discussion on Seconds within the Oracle Miscellaneous forums, part of the Oracle Database category; --> Hi I have a test table. 1 of the columns hav time in second as follows : Seconds 10720 ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 09:04 AM
Reiro
 
Posts: n/a
Default Seconds

Hi

I have a test table. 1 of the columns hav time in second as follows :

Seconds

10720
31
30
31
30
11
20
10
4
2459

I want the data in a new column T in hh24:mm:ss

plz help

thanks in advance

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 09:04 AM
ianal Vista
 
Posts: n/a
Default Re: Seconds

"Reiro" <ReiroGP@gmail.com> wrote in news:1143211729.506918.134210
@g10g2000cwb.googlegroups.com:

> Hi
>
> I have a test table. 1 of the columns hav time in second as follows

:
>
> Seconds
>
> 10720
> 31
> 30
> 31
> 30
> 11
> 20
> 10
> 4
> 2459
>
> I want the data in a new column T in hh24:mm:ss
>
> plz help
>
> thanks in advance
>
>


ALTER TABLE.......

Are you incapable or unwilling to RTFM?

http://download-west.oracle.com/docs/cd/B10501_
01/server.920/a96540/statements_32a.htm#2054899
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 09:04 AM
Jim Kennedy
 
Posts: n/a
Default Re: Seconds


"Reiro" <ReiroGP@gmail.com> wrote in message
news:1143211729.506918.134210@g10g2000cwb.googlegr oups.com...
> Hi
>
> I have a test table. 1 of the columns hav time in second as follows :
>
> Seconds
>
> 10720
> 31
> 30
> 31
> 30
> 11
> 20
> 10
> 4
> 2459
>
> I want the data in a new column T in hh24:mm:ss
>
> plz help
>
> thanks in advance
>

There is a date field which includes the time of the day. Is the seconds
the number of seconds since midnight? If so then
alter table xyz add (mydate_col date);

update xyz set
mydate_col=to_date('1/1/2006','mm/dd/yyyy')+(seconds/(24*60*60));
commit;
Then it would be all as of 1/1/2006. I don't know if that is what you want.
Jim


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-08-2008, 09:04 AM
Anurag Varma
 
Posts: n/a
Default Re: Seconds


You fail to state the version of Oracle.
At least in 9i and above, there is a "interval day to seconds"
datatype.
Which might be closer to what you want.
Unless you want to write a routine yourself to do this conversion.

ORA92> create table dhms (a number, b interval day(0) to second(0));

Table created.

ORA92> insert into dhms (a) values (10720);

1 row created.

ORA92> insert into dhms (a) values (31);

1 row created.

ORA92> update dhms set b = numtodsinterval(a, 'second');

2 rows updated.

ORA92> commit;

Commit complete.

ORA92> select * from dhms;

A B
----------
---------------------------------------------------------------------------
10720 +0 02:58:40
31 +0 00:00:31


Anurag

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-08-2008, 09:05 AM
Reiro
 
Posts: n/a
Default Re: Seconds

Thx guys..... i was looking for a solution like Anurag's

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:14 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com