Implict date conversion [message #371557] |
Tue, 07 November 2000 13:53 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
feng
Messages: 10 Registered: November 2000
|
Junior Member |
|
|
I need to insert date column in my code as:
create table datetest ( mydate date);
INSERT INTO datetest (mydate) values(to_date('07-NOV-2000 14:19:02','dd-MON-yyyy HH24:MI:SS'));
Is it possible to do it without using to_date function?
INSERT INTO datetest (mydate) values('07-NOV-2000 14:19:02');
Any suggestions? Thanks in advance!
Feng
|
|
|
Re: Implict date conversion [message #371562 is a reply to message #371557] |
Wed, 08 November 2000 03:28 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Babu Paul
Messages: 38 Registered: November 2000
|
Member |
|
|
Yes, you can insert a row into datetest table without using to_date function. But prior to that you have to alter the session to have your date format set to DD-MON-YYYY HH24:MI:SS.
Hope this helps. Please see attached query for details.....
alter session set nls_date_format='DD-MON-YYYY HH24:MI:SS' ;
now try the insert statement without using to_date function. It should now create without complaining.
Good luck
Babu Paul
|
|
|
Re: Implict date conversion [message #371575 is a reply to message #371557] |
Thu, 09 November 2000 04:57 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
Babu Paul
Messages: 38 Registered: November 2000
|
Member |
|
|
Hi Feng!
Sorry mate! I can't think of any other method by which this can be accomplished. I do believe the default date format is always going to be DD-MON-YY. So to make the query work without changing session parameters we will be forced to use the TO_DATE function. I am keen to know if someone comes with a better solution. Fingers crossed!
Cheers
Babu
|
|
|