SQL * Loader-如何忽略具有特定字符的某些行 [英] SQL*Loader - How can i ignore certain rows with a specific charactre
问题描述
如果我有以下格式的CSV文件
If i have a CSV file that is in the following format
"fd!","sdf","dsfds","dsfd"
"fd!","asdf","dsfds","dsfd"
"fd","sdf","rdsfds","dsfd"
"fdd!","sdf","dsfds","fdsfd"
"fd!","sdf","dsfds","dsfd"
"fd","sdf","tdsfds","dsfd"
"fd!","sdf","dsfds","dsfd"
是否可以排除第一行在字符串末尾带有感叹号的任何行. 即应仅加载以下行
Is it possible to exclude any row where the first column has an exclamation mark at the end of the string. i.e. it should only load the following rows
"fd","sdf","rdsfds","dsfd"
"fd","sdf","tdsfds","dsfd"
谢谢
推荐答案
According to the Loading Records Based on a Condition section of the SQL*Loader Control File Reference (11g):
您可以使用 WHEN 子句来测试记录中的条件,从而选择加载或丢弃逻辑记录."
"You can choose to load or discard a logical record by using the WHEN clause to test a condition in the record."
所以您需要这样的东西:
So you'd need something like this:
LOAD DATA ... INSERT INTO TABLE mytable WHEN mycol1 NOT LIKE '%!'
(mycol1.. ,mycol2 ..)
但是 LIKE 运算符不可用!您只有 = 和!=
But the LIKE operator is not available! You only have = and !=
也许您可以尝试使用外部表.
Maybe you could try an External Table instead.
这篇关于SQL * Loader-如何忽略具有特定字符的某些行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!