?
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
?
628 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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
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, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
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.

649 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