作为时间间隔的 Teradata 宏参数
这与 Informix 使用参数定义 INTERVAL 几乎是相同的问题但位于 Teradata 中。
我正在创建一个宏,它接受 hh:mm:ss 形式的字符串用作间隔。
该宏想要使用过去 hh:mm:ss 的时间戳执行某些操作。
这是基本的 SQL,
CREATE MACRO TEST_MACRO (
HHMMSS CHAR(8)
)
AS
(
SELECT
CAST(CURRENT_TIME AS TIMESTAMP(0)),
CAST(CURRENT_TIME - INTERVAL :HHMMSS HOUR TO SECOND AS TIMESTAMP(0))
)
我收到错误 Failed 3707:语法错误,需要在“INTERVAL”关键字和“:”之间出现字符串或 Unicode 字符文字
。
有办法解决这个问题吗?
This is almost the same problem as Informix defining an INTERVAL with a parameter but is in Teradata.
I'm creating a macro that accepts a string in the form hh:mm:ss to be used as an interval.
The macro wants to do something with a timestamp in the past hh:mm:ss.
Here's the basic sql
CREATE MACRO TEST_MACRO (
HHMMSS CHAR(8)
)
AS
(
SELECT
CAST(CURRENT_TIME AS TIMESTAMP(0)),
CAST(CURRENT_TIME - INTERVAL :HHMMSS HOUR TO SECOND AS TIMESTAMP(0))
)
I get the error Failed 3707: Syntax error, expected something like a string or a Unicode character literal between the 'INTERVAL' keyword and ':'
.
Is there a way around this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
知道了。
Got it.