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< ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 ...) |
| |||
| 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 |
| ||||
| 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 |