想知道语法含义

问题描述 投票:1回答:2

任何人都可以解释下面的语法它正在做什么,如果我有捐赠金额12345.67889889,如果我只想加载12345.67我必须在上面的语法中更改。

DONATION_AMOUNT NULLIF DONATION_AMOUNT = BLANKS DEFAULTIF DONATION_AMOUNT = 'NULL' "REGEXP_REPLACE(TRIM(:DONATION_AMOUNT),'[,/$]')",
oracle sql-loader
2个回答
0
投票

你能不能使用CAST cast(round(DONATION_MOUNT) as numeric(x,2)),其中x是数字的最大数量


0
投票
NULLIF DONATION_AMOUNT = BLANKS
  If the donation_amount field in the file is blank, set it to NULL in the table.

DEFAULTIF DONATION_AMOUNT = 'NULL'
  If the donation_amount field in the file = the string 'NULL', set it to NULL in the table.

"REGEXP_REPLACE(TRIM(:DONATION_AMOUNT),'[,/$]')"
  The TRIM() call removes blanks from either end of the string read from the file, 
then removes commas, slashes and dollar signs.

除了上述规则之外,要截断到2个小数位,请将其包装在REGEXP_SUBSTR()中,该REGEXP_SUBSTR()匹配一个或多个锚定到字符串开头的数字,后跟一个小数点,后跟最多2个可选数字。

REGEXP_SUBSTR(REGEXP_REPLACE(TRIM(:DONATION_AMOUNT),'[,/$]'), '^\d+\.\d?\d?', 1, 1)
© www.soinside.com 2019 - 2024. All rights reserved.