SQL Loader中的NULLIF比较字符串值 [英] NULLIF in SQL Loader to compare a string value

查看:315
本文介绍了SQL Loader中的NULLIF比较字符串值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有简单行的文件,我想使用sql loader上载到表中.

I have a file with simple rows that I want to upload into a table using sql loader.

但是,有一列包含我要排除的值:

However, there is a column that contain values that I want to exclude:

e.r.

123;Código Postal *;HH;456
523;Código Postal *;HI;459
723;Código Postal *;HM;450

我要排除并指定为NULL的列是值CódigoPostal *".

The column that I want to exclude and asign to NULL is the value "Código Postal *".

我想修改我的控制文件以排除此值,但这是不可能的.

I want to modify my control file to exclude this value, but is not possible.

我已使用控制文件:

 EC_CONS_ZIP_CODE  "DECODE(:EC_CONS_ZIP_CODE,'Código Postal%',NULL,:EC_CONS_ZIP_CODE)"

但是不起作用,因为我有一个特殊字符("*"和ó")

But doesn't work because I have a special character ("*" and "ó")

是否有一种避免使用这种字符的方法或另一种方法?

Is there a way to avoid this kind of character to use it or another way?

是否可以使用控制文件为此单词分配模式?

Is it possible to assign a pattern for this word using Control file?

致谢!

推荐答案

在控制文件中将字符集设置为utf8

Set character set to utf8 in the control file

CHARACTERSET UTF8

另一种方法是使用正则表达式

Another way is to use a regex

EC_CONS_ZIP_CODE  " REGEXP_REPLACE(:EC_CONS_ZIP_CODE,'C.digo Postal.*','')"

或尝试使用针对(00F3)的特定Unicode编码

Or try with the specific Unicode encoding for ó (00F3)

EC_CONS_ZIP_CODE  " REGEXP_REPLACE(:EC_CONS_ZIP_CODE,'C' || unistr('\00F3')|| 'digo Postal.*','')"

这篇关于SQL Loader中的NULLIF比较字符串值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆