Click here to Skip to main content
15,911,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<br />
 Update student_record_database<br />
 set date_of_birth = (to_char('31/12/2000','dd/mm/yyyy'))<br />
 where rollno=122;<br />


What is wrong in this code?????
I just want to update the date in the specified to_char format.
In SQL it shows error like: Invalid number
Please Help
Posted

1 solution

hey u hav add to_date function like this......
SQL
Update student_record_database
set date_of_birth = to_date(to_char('31/12/2000','dd/mm/yyyy'))
where rollno=122;


or use

SQL
Update student_record_database
set date_of_birth = (to_date('31/12/2000','dd/mm/yyyy'))
where rollno=122;


or this will definitly work

SQL
Update student_record_database
set date_of_birth = to_char(to_date('31/12/2000','dd/mm/yyyy'))
where rollno=122;</pre>
 
Share this answer
 
v2
Comments
surkhi 7-Jan-13 2:42am    
It is accepting second and third type of commands but not the first one,and I want the first one too...

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