2

如果我有以下格式的 CSV 文件

"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"

是否可以排除第一列在字符串末尾有感叹号的任何行。即它应该只加载以下行

"fd","sdf","rdsfds","dsfd"
"fd","sdf","tdsfds","dsfd"

谢谢

4

2 回答 2

4

根据SQL*Loader 控制文件参考 (11g) 的基于条件的加载记录部分:

“您可以选择加载或丢弃逻辑记录,方法是使用WHEN子句测试记录中的条件。”

所以你需要这样的东西:

LOAD DATA ... INSERT INTO TABLE mytable   WHEN mycol1 NOT LIKE '%!' 
(mycol1..  ,mycol2 ..)

但是LIKE运算符不可用!你只有 =!=

也许您可以尝试使用外部表。

于 2010-08-22T11:25:26.023 回答
1

我会在桌子上贴上一个约束,然后让他们被拒绝。也许在加载后删除它们。或者一个 unix "grep -v" 来清除它们。

于 2010-08-22T23:04:31.340 回答