Teradata 中 then/else 中的数据类型不匹配
我正在检查 y.cap_ts 的内容,如果有值(非空),则将其替换为 current_date 或将其保留为空。但我在 then/else 错误中遇到数据类型不匹配。
这里 cap_ts 是日期数据类型。
任何人都可以建议更好的解决方法吗?
SET
cap_ts = CASE WHEN y.cap_ts IS NULL AND y.rwrd > 50
THEN current_date
ELSE NULL END
我目前在 Teradata 工作。
I am checking the contents of y.cap_ts
and if there is a value (non null) then replace it with current_date
or else leave it as null. but I get data type mismatch in then/else error.
Here cap_ts is date data type.
Can any one suggest any better work around?
SET
cap_ts = CASE WHEN y.cap_ts IS NULL AND y.rwrd > 50
THEN current_date
ELSE NULL END
I am currently working in teradata.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试将
CURRENT_DATE
替换为CURRENT_TIMESTAMP(0)
。我知道您说过CAP_TS
是DATE
数据类型,但您的命名约定似乎另有说明。与 Oracle 不同,Teradata 中的DATE
数据类型不包含时间部分。如果它实际上被定义为TIMESTAMP
,那么您需要使用CURRENT_TIMESTAMP(n)
,其中n是时间的精度。Try replacing
CURRENT_DATE
withCURRENT_TIMESTAMP(0)
. I know you said thatCAP_TS
is aDATE
data type but your naming convention seems to indicate otherwise. Unlike Oracle, theDATE
data type in Teradata does not include a time component. If it is actually defined as aTIMESTAMP
then you need to useCURRENT_TIMESTAMP(n)
, where n is the precision of the time.