Solved

How to insert specific format like "Mon Jan 06 12:05:26 GMT 2014" while inserting in to time stamp column type in oracle.

Posted on 2014-01-07
3
617 Views
Last Modified: 2014-01-08
How to insert specific format like "Mon Jan 06 12:05:26 GMT 2014" while inserting in to time stamp column type in oracle. we have migartion of data from other db which has the format of date column like "Mon Jan 06 12:05:26 GMT 2014". in order to avoid two different types of dates. we want to keep the datatype in oracle also like this format "Mon Jan 06 12:05:26 GMT 2014"
0
Comment
Question by:ajaybelde
[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
3 Comments
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 250 total points
ID: 39762747
Dates and timestamps in Oracle do not have a format per say.  They are stored in an internal format that is described in the docs.

They only have a format when they are displayed.  This is driven by a default format then be NLS_DATE_FORMAT (for DATE.  TIMESTAMP has a similar one) and last by TO_CHAR with a format mask.



All that said, what are you wanting help with?

Inserting from one database into Oracle?
How the application should insert into an Oracle column?
How the application should convert the timestamp into a string for display?

Also confirm you are talking about the timestamp data type and not the date data type.
0
 
LVL 74

Assisted Solution

by:sdstuber
sdstuber earned 250 total points
ID: 39762773
to convert your string into a timestamp with time zone type use the TO_TIMESTAMP_TZ function and include the proper format

to_timestamp_tz('Mon Jan 06 12:05:26 GMT 2014','Dy Mon dd hh24:mi:ss TZR yyyy')


as noted previously though,  the text format of the string has nothing to do with how the data is stored in the database.

so, similarly to extract the text representation of your timestamp values use TO_CHAR


to_char(your_column,'Dy Mon dd hh24:mi:ss TZR yyyy')
0
 

Author Closing Comment

by:ajaybelde
ID: 39765802
by changing the parameter  set NLS_TIMESTAMP_TZ_FORMAT='Day MON DD HH24.MI.SSXFF TZR RRRR' it allowed me the way i want to insert
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

690 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