Snowflake create procedure - Syntax error: unexpected 'return'
Snowflake create procedure - Syntax error: unexpected 'return'
我想在 snowflake 中做一个程序示例,但我一直收到此错误:
Syntax error: unexpected 'return'. (line 2)
我不知道我错过了什么:
CREATE OR REPLACE PROCEDURE TASKEXAMPLE_PROCEDURE()
RETURNS int
LANGUAGE SQL
AS
$$
return SELECT UNIFORM(1, 10, random()) as nb from table(generator(rowcount => 1)) ;
$$;
感谢您的回答
要在 Snowflake 脚本的存储过程中使用 return,您需要使用块,如 here.
所述
这里是一个使用return的例子:
create or replace procedure area()
returns float
language sql
as
$$
declare
radius float;
area_of_circle float;
begin
radius := 3;
area_of_circle := pi() * radius * radius;
return area_of_circle;
end;
$$
;
我想在 snowflake 中做一个程序示例,但我一直收到此错误:
Syntax error: unexpected 'return'. (line 2)
我不知道我错过了什么:
CREATE OR REPLACE PROCEDURE TASKEXAMPLE_PROCEDURE()
RETURNS int
LANGUAGE SQL
AS
$$
return SELECT UNIFORM(1, 10, random()) as nb from table(generator(rowcount => 1)) ;
$$;
感谢您的回答
要在 Snowflake 脚本的存储过程中使用 return,您需要使用块,如 here.
所述这里是一个使用return的例子:
create or replace procedure area()
returns float
language sql
as
$$
declare
radius float;
area_of_circle float;
begin
radius := 3;
area_of_circle := pi() * radius * radius;
return area_of_circle;
end;
$$
;