Load: oracle tool: sqlldr

Source: Internet
Author: User

Load: oracle tool: sqlldr consists of four steps: creating a table with a source data file (test.txt) and creating a control file (test. ctl), create a bat file (or shell file) focuses on: If the table has the number type, or the date data type can also load the number, the key point is in step 3. The procedure is as follows: 1. Create a table (SCRIPT ):

-- Create tablecreate table TBL_TEST1 (NAME VARCHAR2 (50), PASSWORD VARCHAR2 (10), CREATE_DT DATE, age number (3 )) tablespace USERS pctfree 10 initrans 1 maxtrans 255 storage (initial 64 K minextents 1 maxextents unlimited );

 

2. source data file: test.txt
Ttt, test, 20120302, 80aaa, bbb, 20130506, 90

 

3. Create a control file: test. ctl
Load datainto table TBL_TEST1REPLACEFIELDS terminated by ', 'trailing NULLCOLS (NAME "TRIM (: NAME)", PASSWORD "TRIM (: PASSWORD)", CREATE_DT "TO_DATE (: CREATE_DT, 'yyyymmdd') ", AGE" TO_NUMBER (: AGE )")

 

4. create a bat file (or shell file) or directly run the content in the file in the command line (sqlldr must be configured to the environment variable E: \ oracle \ product \ 10.2.0 \ db_1 \ bin) sqlldr test/litao data = C: \ test.txt control = C: \ test. ctl log = test. log bad = test. bad

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.