Oracle External Table Import time Date type data

Source: Internet
Author: User
Tags create directory

1. Create an external Table directory

Create directory Extdir as ' E:appextdir ';

2. Define External Tables

CREATE TABLE Ext_test

(

RT date,

Rtype char (1)

)

Organization External (

Type Oracle_loader

Default directory Extdir

Access Parameters (

Fields terminated by ', '---field spacer is comma

Missing field values are NULL---outer file line terminator null

(

RT Date "Yyyy-mm-dd HH24:MI:SS",---Defining the time field format type

Rtype char (1)---Define other fields (comma-delimited between multiple fields), with the length defined with the external table

))

Location (' test_ext.txt '));

3. Execute Query statement

Sql> select * from Ext_test;

RT R

-------------- -

January-September -12 D

February-October -12 D

1 September-October -12 D

2 March-November -12 D

20月-November -12 D

November-January -12 D

December-June -12 D

2 May-August -12 D

July-May -12 D

August-April -12 D

10 rows have been selected.

Sql>

Note:

External file Example:

Test_ext.txt File Contents:

2012-09-01,d

2012-10-02,d

2012-10-19,d

2012-11-23,d

2012-11-20,d

2012-01-11,d

2012-06-12,d

2012-08-25,d

2012-05-07,d

2012-04-08,d

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.