Teradata中变量的声明 [英] declaration of variable in teradata

查看:54
本文介绍了Teradata中变量的声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有等效于在 teradata 的 sql 方言中声明类似于此 Sql Server (TSQL) 代码的变量?

Is there an equivalent of declaring a variable similar to this Sql Server (TSQL) code in teradata's sql dialect?

DECLARE @Somedate Date = GETUTCDATE();

SELECT TOP 10 * FROM SOMETABLE WHERE SOMEDATE = @Somedate;

推荐答案

是和否.您不能在直接从代码编辑器运行的典型 SQL 语句中声明变量.您可以(作为一个示例)在存储过程中声明变量.在您的代码编辑器窗口中,您更有可能创建一个易失性表并使用它来存储变量"的值.

Yes and no. You cannot declare variables in a typical SQL Statement that you are running directly from your code editor. You can (as one example) declare variables inside of a stored procedure. In your code editor window, you would be more likely to create a volatile table and use it to store the value of your "variable".

这篇关于Teradata中变量的声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆