Solved

How to create the correct date-time field?

Posted on 2014-09-16
6
397 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.

Join & Write a Comment

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now