不支持的功能'从非恒定源表达式分配'

发布于 2025-01-18 02:59:20 字数 168 浏览 0 评论 0原文

执行标准脚本时,我们收到以下错误:

错误: 不支持的功能“来自非常量源表达式的分配”。

脚本 设置 geo = (选择 st_makepoint(-79.3810586,43.6562331));

We are getting the below error when executing a standard script:

Error:
Unsupported feature 'assignment from non-constant source expression'.

Script
set geo = (Select st_makepoint(-79.3810586,43.6562331));

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

獨角戲 2025-01-25 02:59:20

所以你的 SQL 自己运行,这是一个很好的开始:

Select st_makepoint(-79.3810586,43.6562331);
ST_MAKEPOINT(-79.3810586,43.6562331)
{ "coordinates": [ -7.938105860000000e+01, 4.365623310000000e+01 ], "type": "Point" }

所以一个简单的块动态类型让:

begin
    let geo := (Select st_makepoint(-79.3810586,43.6562331));
    return geo;
end;

092228 (P0000): SQL 编译错误:错误第 2 行位于位置 4

变量“GEO”无法从初始值设定项推断其类型

因此提前声明类型会给出:

declare
    geo GEOGRAPHY;
begin
    geo := (Select st_makepoint(-79.3810586,43.6562331));
    return geo;
end;

000603(XX000):SQL执行内部错误:

由于错误 300010:3443530546,处理中止;事件6816246。

那不好。但这可能与它尚未进入正式版有关。

https://docs.snowflake。 com/en/developer-guide/snowflake-scripting/variables.html#declaring-a-variable

变量的数据类型。这可以是:

SQL 数据类型(此预览版本中的 GEOGRAPHY 除外)。

所以如果你打开了预览功能,上面的方法可能对你有用..

但是“标准程序”你指的是一个JavaScript程序:

create procedure f()
returns GEOGRAPHY
language javascript
as
$
    var geo_sql = 'Select st_makepoint(-79.3810586,43.6562331)';
    
    var stmt1 = snowflake.createStatement( { sqlText: geo_sql } );

    var results1 = stmt1.execute();

    results1.next();
    
    return results1.getColumnValue(1);
$
;

我们可以称之为

call f();
F
{“坐标”:[-7.938105860000000e+01, 4.365623310000000e+01 ], "type": "Point" }

这样就可以了..

So you SQL run by itself, that's a good start:

Select st_makepoint(-79.3810586,43.6562331);
ST_MAKEPOINT(-79.3810586,43.6562331)
{ "coordinates": [ -7.938105860000000e+01, 4.365623310000000e+01 ], "type": "Point" }

so a simple block with the dynamic type let:

begin
    let geo := (Select st_makepoint(-79.3810586,43.6562331));
    return geo;
end;

092228 (P0000): SQL compilation error: error line 2 at position 4

variable 'GEO' cannot have its type inferred from initializer

so declaring the type ahead of time give:

declare
    geo GEOGRAPHY;
begin
    geo := (Select st_makepoint(-79.3810586,43.6562331));
    return geo;
end;

000603 (XX000): SQL execution internal error:

Processing aborted due to error 300010:3443530546; incident 6816246.

that not good. but it might be related to the fact it's not in GA yet.

https://docs.snowflake.com/en/developer-guide/snowflake-scripting/variables.html#declaring-a-variable

The data type of the variable. This can be:

A SQL data type (except for GEOGRAPHY in this preview version).

so if you have the preview feature turned on the above might work for you..

But by "standard procedure" you mean a JavaScript Procedure:

create procedure f()
returns GEOGRAPHY
language javascript
as
$
    var geo_sql = 'Select st_makepoint(-79.3810586,43.6562331)';
    
    var stmt1 = snowflake.createStatement( { sqlText: geo_sql } );

    var results1 = stmt1.execute();

    results1.next();
    
    return results1.getColumnValue(1);
$
;

which we can call

call f();
F
{ "coordinates": [ -7.938105860000000e+01, 4.365623310000000e+01 ], "type": "Point" }

so that works..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文