Solved

How to create the correct date-time field?

Posted on 2014-09-16
6
402 Views
Last Modified: 2014-09-16
Dear Experts,

I have a CSV file with a field like below:

"May 28 00:14:39","Event-001","This is error event"

I would like to load such files to an Oracle table using external tables. However I do not know which Oracle Data Type I'm going to create for the first field (which is May 28 ...) while creating table.

Note: I'll perform  insert into oracle-table select * from external-table.  

BR
0
Comment
Question by:GurcanK
  • 3
  • 3
6 Comments
 
LVL 13

Assisted Solution

by:Alexander Eßer [Alex140181]
Alexander Eßer [Alex140181] earned 500 total points
ID: 40324784
- Date type should/could be DATE
- for converting you may use: to_date('May 28 00:14:39', 'mon dd hh24:mi:ss')
0
 

Author Comment

by:GurcanK
ID: 40324791
How shall I define this "to_date" in create table statement?
0
 

Author Comment

by:GurcanK
ID: 40324805
In other words will external table read this field correctly with type DATE?
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 13

Accepted Solution

by:
Alexander Eßer [Alex140181] earned 500 total points
ID: 40324808
You said, you're doing a "insert into oracle-table select * from external-table"?!
If you define  that date column upon your oracle-table then you could do "insert into oracle-table select col1, col2, col3, to_date(col4, 'mon dd hh24:mi:ss')  from external-table".
For the create table statement, regarding your oracle table, there is no need to cast with to_date function unless you do the loafding via CTAS....
0
 

Author Comment

by:GurcanK
ID: 40324813
Now, that's OK thanks.
0
 
LVL 13

Expert Comment

by:Alexander Eßer [Alex140181]
ID: 40324818
You're welcome. Don't hesitate to come back in case you need further help ;-)
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What is the version of ojdbc6.jar 2 58
clob to char in oracle 3 38
1 FROM DUAL wont work with additional columns ?? 4 36
Creation date for a PDB 5 21
This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

770 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