I'm trying to create a report of information in a scheduling database. The scheduling information is divided into 2 fields, one for the date and another for the time.
The START_DATE field is a DATE datatype. The START_TIME is VARCHAR2 with times entered as 0, 30, 100, 130, ... 2330.
To further complicate things, some times are entered as Eastern and others as GMT.
I need to be able to standardize the times for comparison in the report.
I started with trying to combine the date and time fields into a date.
This query will output the date/time in the desired format (i.e. 200603260400):
But when I try to convert it to a date for comparison, I get an error:
How can I do what I need to do?
And once I get that part working, I'll need be able to add or subtract 5 hours from a date (4 durning daylight savings).
That's (DATE_FIELD - (5/24)), right?
_________
Rott Paws
...It's not a bug. It's an undocumented feature!!!
The START_DATE field is a DATE datatype. The START_TIME is VARCHAR2 with times entered as 0, 30, 100, 130, ... 2330.
To further complicate things, some times are entered as Eastern and others as GMT.
I need to be able to standardize the times for comparison in the report.
I started with trying to combine the date and time fields into a date.
This query will output the date/time in the desired format (i.e. 200603260400):
Code:
select
r.*,
to_char(start_date, 'YYYYMMDD') || lpad(start_time,4,'0') SDT
from
reservations r
But when I try to convert it to a date for comparison, I get an error:
Code:
select
start_date,
start_time,
customer_name
from
(select
r.*,
to_char(start_date, 'YYYYMMDD') || lpad(start_time,4,'0') SDT
from
reservations r) res
where
to_date(res.sdt, 'YYYYMMDDHH24MI') > sysdate
to_date(res.sdt, 'YYYYMMDDHH24MI') > sysdate
*
ERROR at line 12:
ORA-01850: hour must be between 0 and 23
How can I do what I need to do?
And once I get that part working, I'll need be able to add or subtract 5 hours from a date (4 durning daylight savings).
That's (DATE_FIELD - (5/24)), right?
_________
Rott Paws
...It's not a bug. It's an undocumented feature!!!