Reading timestamps when importing data in SQL Deve

2019-08-08 05:51发布

问题:

I am trying to read a text file into an Oracle database using the Data Import Wizard in SQL Developer.

I am stuck on step 5 because I cannot get the Verify parameters before import to succeed on my timestamp fields.

Going back to step 4, I have tried changing the Data type of my timestamp fields to Timestamp, Timestamp with time zone, and Timestamp with local time zone. In desperation, I even tried Date. Nothing worked.

I then noticed the Format field that shows up when you select any of the Timestamp... or Date types for the "Data Type" field. So, I tried specifying the format for my data, an example of which follows: 01/03/2008 06:25:00 AM -0500.

Not sure what the proper codes are for the format and finding no documentation online, offline, or in my head, I tried all of the following formats to no avail: MM/DD/YYYY HH:mm:SS AM +0000; MM/DD/YYYY HH:mi:SS AM +0000; MM/DD/YYYY HH12:mm:SS AM +0000; mm/dd/yyyy hh:mm:ss AM +0000.

In further desperation, I have tried many, many combinations of the various encodings for each of the sub-elements of the timestamp: MM and mm for month, DD and dd for day, YYYY and yyyy for year, HH and hh and HH12 for hour, mm and mi for minute, SS and ss for second, and lots of crazy stuff for the AM/PM and time zone fields. Nothing has worked.

So, stackoverflow patrons, I ask for your help. I have tried searching for a solution to this problem and I have tried lots of different solutions on my own. I have done my best, but my best hasn't been good enough on this problem. Help me Obi Wan; you're my only hope.

回答1:

You probably want the date/time format:

MM/DD/YYYY HH12:MI:SS AM TZHTZM

And this is the date format documentation.

And you'll need to selet a data type with timezone.