[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
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
?
637 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
3 Comments
 
LVL 78

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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…
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
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 information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
Suggested Courses
Course of the Month19 days, 16 hours left to enroll

872 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