Unix Technical Forum

Convert date into timestamp before runnin the a query

This is a discussion on Convert date into timestamp before runnin the a query within the Oracle Miscellaneous forums, part of the Oracle Database category; --> Hello, ==> I have to run the following query --------------- select * from tec_t_evt_rep where (date_reception> $begin and date_reception< ...


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, 12:39 PM
leoh
 
Posts: n/a
Default Convert date into timestamp before runnin the a query

Hello,

==> I have to run the following query

---------------
select * from tec_t_evt_rep where (date_reception> $begin and
date_reception< $end) or (last_modified_time > $begin and
last_modified_time < $end)
----------------

$begin => first timestamp
$end => last timestamp

==> The problem is, last_modified_time is VARCHAR in the date format
dd/mm/yy

Is it possible to create a query where last_modified_time is converted
to timestamp before the query execution? Somenting like :

select (...) or (convert_timestamp(last_modified_time,'dd/mm/yy')
and ...)

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 12:39 PM
DA Morgan
 
Posts: n/a
Default Re: Convert date into timestamp before runnin the a query

leoh wrote:
> Hello,
>
> ==> I have to run the following query
>
> ---------------
> select * from tec_t_evt_rep where (date_reception> $begin and
> date_reception< $end) or (last_modified_time > $begin and
> last_modified_time < $end)
> ----------------
>
> $begin => first timestamp
> $end => last timestamp
>
> ==> The problem is, last_modified_time is VARCHAR in the date format
> dd/mm/yy
>
> Is it possible to create a query where last_modified_time is converted
> to timestamp before the query execution? Somenting like :
>
> select (...) or (convert_timestamp(last_modified_time,'dd/mm/yy')
> and ...)


It would be better to fix the bad design. But have you looked at
TO_TIMESTAMP?
www.psoug.org
Click on Morgan's Library
Click on Built-in Functions at the top of the page
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 12:41 PM
leoh
 
Posts: n/a
Default Re: Convert date into timestamp before runnin the a query


Thank you very much!


On 26 abr, 00:54, DA Morgan <damor...@psoug.org> wrote:
> leoh wrote:
> > Hello,

>
> > ==> I have to run the following query

>
> > ---------------
> > select * from tec_t_evt_rep where (date_reception> $begin and
> > date_reception< $end) or (last_modified_time > $begin and
> > last_modified_time < $end)
> > ----------------

>
> > $begin => first timestamp
> > $end => last timestamp

>
> > ==> The problem is, last_modified_time is VARCHAR in the date format
> > dd/mm/yy

>
> > Is it possible to create a query where last_modified_time is converted
> > to timestamp before the query execution? Somenting like :

>
> > select (...) or (convert_timestamp(last_modified_time,'dd/mm/yy')
> > and ...)

>
> It would be better to fix the bad design. But have you looked at
> TO_TIMESTAMP?www.psoug.org
> Click on Morgan's Library
> Click on Built-in Functions at the top of the page
> --
> Daniel A. Morgan
> University of Washington
> damor...@x.washington.edu
> (replace x with u to respond)
> Puget Sound Oracle Users Groupwww.psoug.org



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 07:29 AM.


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