Home » RDBMS Server » Server Administration » Implict date conversion
Implict date conversion [message #371557] Tue, 07 November 2000 13:53 Go to next message
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 messageGo to next message
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
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
Previous Topic: replace single quote
Next Topic: New to Oracle:How do I download a package.proc
Goto Forum:
  


Current Time: Fri May 03 14:36:49 CDT 2024