| Convert to date [message #632051] |
Fri, 23 January 2015 12:14  |
rajivn786
Messages: 161 Registered: January 2010
|
Senior Member |
|
|
Hi,
I have a simple question which I am unable to convert to date...
I have the following stored in varchar2 field ..
2011-07-20T20:57:48.0
Create table a (b varchar2(100));
Insert into a ('2011-07-20T20:57:48.0');
How do I convert this into date format?
The O/p should be
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Re: Convert to date [message #632672 is a reply to message #632671] |
Wed, 04 February 2015 02:55  |
cookiemonster
Messages: 13975 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
sridharangoji wrote on Wed, 04 February 2015 08:34First of all in your query 'values' keyword is missed. So ERROR at line 1:
ORA-00928: missing SELECT keyword occurred.
That's just repeating what Blackswan already pointed out.
sridharangoji wrote on Wed, 04 February 2015 08:34
Second : if you want datatype conversation use To_date function with formatting as following.
Insert into a values(To_date('2011-07-20 20:57:48', 'YYYY-MM-DD HH24:MI:SS'));
That'll error out with the OPs actual data.
|
|
|
|