BigQuery:for循环中用于数据集名称的输入参数

问题描述 投票:0回答:1

我有一个存储过程,它使用 for 循环来读取表中的记录并执行一些操作。 是否可以使用输入参数来指定数据集和表名称?

例如 - 在下面的代码中,如何使用 in_dataset_id 和 in_table_name 代替 def.test_table?

create or replace procedure abc.test_proc (in_dataset_name string, in_table_name string)
begin

-- Loop through each table that potentially needs deletes

  for record in
     (select account_id
        from def.test_table)
  do
for-loop google-bigquery arguments procedural
1个回答
0
投票

创建或替换过程 abc.test_proc (in_dataset_name string, in_table_name string) 开始

-- 循环遍历可能需要删除的每个表

记录在 (选择 account_id 来自

dataset_name.table_name
) 做 结束于; 结束;

© www.soinside.com 2019 - 2024. All rights reserved.