teradata betq 从查询中分配变量
teradata betq assigning variable from query
我有一个具有参数化日期值的 BTEQ 脚本。日期值是根据另一个 select 查询设置的。如何执行 select 查询以读取日期并在 BTEQ 脚本中使用
例子
从表 1 中读取最大值(order_date)
select max(order_date) as max_order_date
来自表 1
在 BTEQ
中使用 max_order_date
select max_order_date as report_run_dt, ....
从表 2
...
如何读取 max_order_paramter 并将其存储为要传递给 BTEQ
的日期参数
用一列创建 volatile table,插入变量。所以 volatile table 将是一列,一行。立即将其与您的 select 查询一起使用。
CREATE VOLATILE TABLE maxdt
AS
select max(order_date) as max_order_date from table1
WITH DATA;
select maxdt.max_order_date as report_run_dt, ....
from table2 cross join maxdt;
我有一个具有参数化日期值的 BTEQ 脚本。日期值是根据另一个 select 查询设置的。如何执行 select 查询以读取日期并在 BTEQ 脚本中使用 例子
从表 1 中读取最大值(order_date)
select max(order_date) as max_order_date 来自表 1
在 BTEQ
中使用 max_order_dateselect max_order_date as report_run_dt, .... 从表 2 ...
如何读取 max_order_paramter 并将其存储为要传递给 BTEQ
的日期参数用一列创建 volatile table,插入变量。所以 volatile table 将是一列,一行。立即将其与您的 select 查询一起使用。
CREATE VOLATILE TABLE maxdt
AS
select max(order_date) as max_order_date from table1
WITH DATA;
select maxdt.max_order_date as report_run_dt, ....
from table2 cross join maxdt;