How to query Oracle data by referring to text documents

Source: Internet
Author: User

In the database, I run the following query statements:
Select PLAN_ID, EL_ID, NIIN, ITEM_NAME, PROJECT_CD,
Case when LCMC_DOC_NO is null then mrodoc else LCMC_DOC_NO end as "document number"
FROM EQLIST_VIEW
WHERE PLAN_ID IN (736,1011)
AND LCMC_DOC_NO IN ('w56hzv0327w501 ', 'w52h090313x006', 'w52h090314x026 ',
'W52h090314x027 ', 'w52h090318x049', 'w52h090320x003 ', 'w56hzv0351m012 ',
'W56hzv0351m032 ', 'w56hzv0351m035', 'w919ad0334l091 ', 'w919ad0334l092 ',
'W919ad0352l025 ', 'w919ad0358l012', 'w919ad0358l017 ', 'w919ad01_l020 ',
'W56hzv0350m001 ')
Order by niin, "document number"
The problem is that there are more than 4000 DOC_NO files. I want to extract the data and put it into a text file on drive C. I tried several methods, but the system always prompts the "Syntax error near 'C'" error '"

So I wrote another query:

Select PLAN_ID, EL_ID, NIIN, ITEM_NAME, PROJECT_CD,
Case when LCMC_DOC_NO is null then mrodoc else LCMC_DOC_NO end as "document number"
FROM EQLIST_VIEW
WHERE PLAN_ID IN (736,1011)
AND LCMC_DOC_NO in c:/Users/aj. moon/Desktop/TEMP/A5A_DOCNUM.TXT
Can you provide some good suggestions?

A: You didn't say which version of the Oracle database you are using, so I assume it is Oracle 9i first. The first problem is that you cannot directly use text files. First, you must make the data available in the database. You can use SQL * Loader to load data or create an external table. Here I will briefly introduce the second method.

External tables allow Oracle to query data stored in flat files outside the database. You can access the formatted storage data loaded by SQL * Loader. For external tables, you cannot use INSERT/UPDATE/DELETE operations, but you can use them in queries. Once you create an external table, you can use it in the view and create synonyms. Generally, external tables are used for ETL operations to prevent data from entering real tables. However, if you want to query External tables frequently, you need to consider loading data into real tables. Because external tables cannot be indexed, the performance will be greatly affected.
 

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.