从任务运行过程时会记录以下错误消息,但当我手动运行它时工作正常:
存储过程 STAGE_SERVICEBUS_ORDER 中的执行错误:JSON 响应中缺少“查询代码”在 Statement.execute 第 4 行位置 60。
该过程如下所示:
CREATE OR REPLACE PROCEDURE "STAGE_SERVICEBUS_ORDER"(YEARMONTH VARCHAR)
RETURNS VARCHAR(16777216)
LANGUAGE JAVASCRIPT
EXECUTE AS OWNER
AS '
snowflake.createStatement({ sqlText: `Truncate table DM.STG.SERVICEBUS_ORDER`}).execute();
var copy_into_statement = `copy into DM.STG.SERVICEBUS_ORDER (FILE_NAME,OBJECT) from ( select metadata$filename, $1 from @SERVICEBUS_ORDER`+YEARMONTH+` ) file_format = (type = ''JSON'' strip_outer_array = false) force=true ON_ERROR = CONTINUE `;
snowflake.createStatement({ sqlText: copy_into_statement}).execute();
return ''Done'';
';