Solved

How to create the correct date-time field?

Posted on 2014-09-16
6
401 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
oracle report printing 2 pages in one page 2 57
Dataware house query tuning 9 64
passing parameters to sql script oracle 4 26
Oracle sql query 7 40
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…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
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 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.

911 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

25 Experts available now in Live!

Get 1:1 Help Now