?
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
Medium Priority
?
621 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 1000 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 1000 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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Via a live example, show how to take different types of Oracle backups using RMAN.
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.
Suggested Courses

764 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