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.