Hi,
I am trying to compare times only from date value i.e. independent of dates. I am trying to do this using the to_date function not sure if this is the best way..... but I come up against this error...... see block below
declare
test date;
begin
test:=TO_DATE(sysdate,'hh24:mi:ss');
dbms_output.put_line(test);
end;
/
which results in
ORA-01850: hour must be between 0 and 23
ORA-06512: at line 4
However works with a varchar2 i.e.
declare
test varchar2(100);
begin
test:=TO_char(sysdate,'hh24:mi:ss');
dbms_output.put_line(test);
end;
/
Is the to_char the only route?
Any ideas greatly appreciated,
Gareth
I am trying to compare times only from date value i.e. independent of dates. I am trying to do this using the to_date function not sure if this is the best way..... but I come up against this error...... see block below
declare
test date;
begin
test:=TO_DATE(sysdate,'hh24:mi:ss');
dbms_output.put_line(test);
end;
/
which results in
ORA-01850: hour must be between 0 and 23
ORA-06512: at line 4
However works with a varchar2 i.e.
declare
test varchar2(100);
begin
test:=TO_char(sysdate,'hh24:mi:ss');
dbms_output.put_line(test);
end;
/
Is the to_char the only route?
Any ideas greatly appreciated,
Gareth