Solved

how to change datetime format from dataset and store into oracle

Posted on 2008-06-12
2
1,216 Views
Last Modified: 2013-12-19
Hi expert,

I have the dataset which contains datatime formated  as 12/06/2008 12:00:00, I need to reformat it as 12-June-2008 to store into ORACLE database, otherwise it give me error as ORA-01861: literal does not match format string

can some one give me advise how to solve this issue.

Thanks in advance

Ying
0
Comment
Question by:ying88888
  • 2
2 Comments
 
LVL 29

Expert Comment

by:MikeOM_DBA
ID: 21773804
Oracle does not store dates in any particular format.

To have Oracle display dates in a specific format, set the NLS_DATE_FORMAT parameter:

ALTER SYSTEM SET NLS_DATE_FORMAT='DD-Month-YYYY';

Open in new window

0
 
LVL 29

Accepted Solution

by:
MikeOM_DBA earned 250 total points
ID: 21773838
...OR Alter session.
If you have an external dataset in a particular format, use the TO_DATE() function to load into an oracle date column:



SQL> ALTER SESSION SET NLS_DATE_FORMAT='DD-Month-YYYY';
 

Session altered.
 

SQL> SELECT TO_DATE('12/06/2008 12:00:00','DD/MM/YYYY HH24:MI:SS') FROM DUAL;
 

TO_DATE('12/06/20

-----------------

12-June-2008
 

SQL> 

Open in new window

0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows how to recover a database from a user managed backup
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now