Import and process TXT files in Oracle

Source: Internet
Author: User
Welcome to the Oracle community forum and interact with 2 million technical staff. When you enter the Oracle database, you will often encounter the problem of importing TXT files to Oracle for processing, in this way, the TXT data can be analyzed and processed. The following describes the complete import and processing methods as a reference. Other departments store their data in the form of. xls.

Welcome to the Oracle community forum to interact with 2 million technical staff> when you enter the Oracle database, you will often encounter the problem of importing TXT files to Oracle for processing, in this way, the TXT data can be analyzed and processed. The following describes the complete import and processing methods as a reference. Other departments store their data in the form of. xls.

Welcome to the Oracle community forum and interact with 2 million technical staff> enter

Oracle databases often encounter the problem of importing TXT files to Oracle for processing, so that you can analyze and process the data in TXT files. The following describes the complete import and processing methods as a reference.

Other departments have their own data in the form of. xls. First, we need to process the column data and store it in TXT.

You can directly copy this column of data to a text editor such as Notepad ++ to prevent the occurrence of DOS line breaks. Otherwise, the data will not be successfully imported into the Oracle database.

The last row of the copied data in this column is always empty and needs to be deleted.

A txt file is generated, and 1.txt is generated.

Now, upload 1.txt to the Linux Script directory through FTP to facilitate the import.

During import, we need to use two programs: one is the import script daoru. sh and the other is the Import Control File daoru. ctl. To import all the programs in the script file, we only have one imported column, so we only need to create a column of TABLE PHONE_NO to meet our needs. If there are more columns, you can add them on your own.

Is the control file daoru. ctl. What we need to do is execute daoru. sh script to generate the temporary table hh_tmp1 and insert a column of PHONE_NO char (11) fields. The mobile phone number is 11 bits. We can use char (11.

After the execution, our 1.txt file has been imported into the temporary table hh_tmp1 of the database, because it is in the daoru. in the sh script, we have eliminated repeated operations on the imported data, so we only need to extract the data we want according to our needs.

We use PLSQL Developer. The database users logged on to by PLSQL Developer must be consistent with the database users you use in the script, and are connected through the original database table, to obtain the data we need.

Two columns are extracted: PHONE_NO and BELONG_CODE. The BELONG_CODE is sorted in ascending order to distinguish the region from the region.

Another example is to convert 1.txt to excel format, and then open it in windows. But the statements executed in linux.

Cat exp_imp_report.list | sed's/|/\ t/G'> 1.xls

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.