Click here to Skip to main content
15,899,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
sir, please help me that i am using oracle 10g, and trying to insert date in table by using 7/7/2012 or 2012/7/7 format type but month invalid error appear....please help me to rite format
Posted
Comments
Kenneth Haugland 11-Aug-12 4:50am    
Try american culture on the datetime. Write tostring("MM/dd/yyyy") and see if that solves it :)
parshdhage 13-Aug-12 4:20am    
thaxxxx..!!! its working..!!
AmitGajjar 11-Aug-12 5:24am    
what is your database field datatype ? it should be datetime.
parshdhage 13-Aug-12 4:21am    
i was used Datetime datatype bt oracle 10g having INVALID MONTH error appear ..i changed it to DATE...and now its working..!
AmitGajjar 13-Aug-12 4:43am    
are you passing DateTime object value in the query ?

1 solution

for inserting date in oracle you need to use to_date function. try this one.
SQL
insert into table_name
(date_field)
values
(to_date('2003/05/03 21:02:44', 'yyyy/mm/dd hh24:mi:ss'));

Raj
 
Share this answer
 
Comments
parshdhage 13-Aug-12 4:23am    
thanxx for solution..!!
_Raj sinha 13-Aug-12 4:44am    
if the solution works then vote for me and accept 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