【发布时间】:2020-04-05 02:02:09
【问题描述】:
如果我在 DB2 SQL 日期转换中遇到错误,我可以使用什么语法来捕获/报告 错误,同时允许作业继续。例如:写入文件或记录或打印文件?
示例: TIMESTAMP_FORMAT(CHAR(MYDATE)) 其中 MYDATE = '20200132'
错误信息:
Message . . . . : Expression not valid using format string specified
for TIMESTAMP_FORMAT.
Cause . . . . . : Argument 1 of the TIMESTAMP_FORMAT function can not
be interpreted using the format string specified in argument 2 for
one of the following reasons:
-- The string expression is too short or too long.
-- The string expression does not conform to the template specified
in the format string.
-- Too many digits were specified in the string expression for the
corresponding format element in the format string.
-- A value in the string expression is not valid for the
corresponding format element in the format string.
Recovery . . . : Specify a valid format string for the function. Try
【问题讨论】:
-
在运行 DB2 代码之前是否有机会清理数据?
-
好主意,但是如何使用 SQL 来识别不良数据?
-
很好的讨论在这里...stackoverflow.com/questions/52297100/…