【发布时间】:2021-10-11 09:23:14
【问题描述】:
我想将存储过程中的日志记录和状态消息返回给调用它的 TASK。
create or replace procedure status_return()
returns string not null
language javascript
as
$$
var result_status = 'The return status and debug information in string format';
return result_status; // Statement returned for info/debug purposes
$$;
我想将存储过程调用 status_return() 的结果传递回任务
-- Create a task that calls the stored procedure every hour
create or replace task call_SP
warehouse = SMALL
schedule = '1 minute'
as
call status_return();
当我执行 TASK_HISTORY 来查看 RETURN_VALUE 时总是空的。
select *
from table(information_schema.task_history(SCHEDULED_TIME_RANGE_START => dateadd(hours, -5, current_timestamp()) ,
TASK_NAME => 'call_sp'));
如何在task_history 中查看存储过程的成功、失败或错误结果?
我尝试通过以下方式创建任务,但不成功并且返回错误。
create or replace task call_SP
warehouse = EDS_SMALL
schedule = '1 minute'
as
call system$set_return_value(call status_return());
我可以在任务中使用 Javascript 吗?将存储过程调用的结果存储到变量中并返回给TASK结果
【问题讨论】:
标签: snowflake-cloud-data-platform snowflake-schema