[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

how to change datetime format from dataset and store into oracle

Posted on 2008-06-12
2
Medium Priority
?
1,232 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 750 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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ā€¦
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
This video shows how to recover a database from a user managed backup

650 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