Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all good morning..

i have tried to update a table by using date comparison like below syntax.

update table_name set employee_salary=100000 where emp_id='121'
and to_char(to_date(JOIN_DATE,'DD-MON-YY HH24:MI:SS'),'YYYY-MM-DD HH24:MI:SS') < to_char(TO_DATE(V_JOIN_DATE,'YYYY-MM-DD HH24:MI:SS:SSSSS'),'YYYY-MM-DD HH24:MI:SS');


in the above query join_date in the table is DATE type and V_JOIN_DATE is varchar2(50).


for the above query i am getting below error.
CSS
ORA-01836: hour conflicts with seconds in day
01836. 00000 -  "hour conflicts with seconds in day"
*Cause:
*Action:


i have tried to select date by using below query

SELECT TO_DATE('2013-09-18 05:32:54:00000','YYYY-MM-DD HH24:MI:SS') FROM DUAL;

but here also getting same below error.
CSS
ORA-01830: date format picture ends before converting entire input string
01830. 00000 -  "date format picture ends before converting entire input string"
*Cause:
*Action:



but i need compare join_date upto 2013-09-18 05:32:54.

is there any solution to solve the above errors and to get mentioned date format.
Posted

1 solution

Oracle stores only the fractions up to second in a DATE field.

Use TIMESTAMP instead:
SQL
SELECT TO_TIMESTAMP('2013-09-18 05:32:54:00000','YYYY-MM-DD HH24:MI:SS,FF') D FROM DUAL;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900