[英]Issue while checking data before loading in sql data loader
I am using the following code excerpt while loading data in Oracle DB using sql loader: 使用sql loader在Oracle DB中加载数据时,我正在使用以下代码摘录:
"tran_code POSITION(238:239)," +
"frm_acct POSITION(247:265) \"TO_NUMBER(:frm_acct)\" NULLIF :frm_acct='*******************'," +
"to_acct POSITION(269:287)," +
It is giving an error on NULL IF i guess the issue is clear that i want to insert null when the data contains only asterisk otherwise convert to number and insert. 如果我想问题很明显,那就是我想在数据仅包含星号时插入null,否则转换为数字并插入,这将导致NULL错误。
thanx in advance. 提前谢谢。
You can try something like this - 您可以尝试这样的事情-
"decode(:YOUR_COL,'***************',NULL,TO_NUMBER(:YOUR_COL))"
However, I suggest better option in this scenarios is the "external table". 但是,我建议在这种情况下更好的选择是“外部表”。 Here's link for your reference :- http://docs.oracle.com/cd/B19306_01/server.102/b14215/et_concepts.htm
这是供您参考的链接: -http : //docs.oracle.com/cd/B19306_01/server.102/b14215/et_concepts.htm
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.