当前位置: 动力学知识库 > 问答 > 编程问答 >

oracle - SQLLDR -- selective loading from pipe delimited txt

问题描述:

I am looking for a way to do selective loading using SQLLDR.

The source file is in "pipe delimited" format.

I know there is a way for this if the source is in a predefined position. It is explained here, by using WHEN & POSITION keywords.

What could I do if the source file is "pipe or tab" delimited?

网友答案:

I am not sure what you mean with "selective loading"?

But ify you are only asking how you can load a file where each column is delimited with a pipe, then use the option FIELDS TERMINATED BY '|' in the control file.

See the chapter "Variable Record Format" in the SQL*Loader manual for more details and examples:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_concepts.htm#sthref476

网友答案:

Depending on which version of the SQLLDR version you are using, you can use the keyword FILLER to skip a field from the file.

The below instruction will skip the second field in the file.

LOAD DATA
TRUNCATE INTO TABLE T1
FIELDS TERMINATED BY ','
( field1,
  field2 FILLER,
  field3
)
网友答案:
LOAD DATA
INFILE 'c:\myfile.txt'  
TRUNCATE INTO TABLE T1
FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS (field1, field2 , field3, field4)
分享给朋友:
您可能感兴趣的文章:
随机阅读: