A stored procedure returns a single row that contains a single column; it is not designed to return a result set. However, if your result set is small enough to fit into a single value of type VARIANT or ARRAY, you can return a result set from a stored procedure with some additional code- here
Hope this helps!
It works for delete statement! Example below:
use role sysadmin;
create or replace database DATA_IMPORTS_SO;
create or replace table ProductMaster_SO (id integer, name varchar);
insert into ProductMaster_SO values (1,'stackoverflow');
insert into ProductMaster_SO values (2,'stackoverflow');
select count(*) FROM DATA_IMPORTS_SO.PUBLIC.ProductMaster_SO;--2 rows
create or replace procedure Clenup_DI_Products()
returns string not null
language javascript
EXECUTE AS OWNER
as
$$
var sql_command =
"delete FROM DATA_IMPORTS_SO.PUBLIC.ProductMaster_SO";
try {
snowflake.execute (
{sqlText: sql_command}
);
return "Succeeded."; // Return a success/error indicator.
}
catch (err) {
return "Failed: " + err; // Return a success/error indicator.
}
$$;
call Clenup_DI_Products();
select count(*) FROM DATA_IMPORTS_SO.PUBLIC.ProductMaster_SO;--0 rows
show tables
– Nick.McDermaid