插入在存储过程中不起作用的温度表中

发布于 2025-01-28 04:01:36 字数 597 浏览 3 评论 0原文

该脚本在DBEAVER上运行时正常工作,我可以使用新的创建临时表:

SELECT someField
INTO TEMP tmp_TableZZ 
FROM "_fdw_xxx".myTable;

但是在存储过程中,我会收到此错误消息:

  SQL错误[42601]:错误:“ temp”不是已知的变量
 

相同的代码:

CREATE OR REPLACE procedure PopulateSomething() 
  LANGUAGE plpgsql
AS $procedure$
    DECLARE v_ReportDte date;
begin

--some code omitted

    SELECT someField
    INTO TEMP tmp_TableZZ 
    FROM "_fdw_xxx".myTable;

--some code omitted

end; $procedure$
;

使用临时而不是temp获得了相同的结果。

This script works fine when running on dbeaver, I can work with the new created temp table:

SELECT someField
INTO TEMP tmp_TableZZ 
FROM "_fdw_xxx".myTable;

But when inside a stored procedure, I got this error message:

SQL Error [42601]: ERROR: "temp" is not a known variable

Same code:

CREATE OR REPLACE procedure PopulateSomething() 
  LANGUAGE plpgsql
AS $procedure$
    DECLARE v_ReportDte date;
begin

--some code omitted

    SELECT someField
    INTO TEMP tmp_TableZZ 
    FROM "_fdw_xxx".myTable;

--some code omitted

end; $procedure$
;

Using TEMPORARY instead of TEMP got the same result.

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

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

发布评论

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

评论(1

终遇你 2025-02-04 04:01:36

好吧,我发现Select In In SQL与select in in in in in pgsql有所不同。
前者接受温度为参数,后者期望有一个可存储一些值的变量。

well, I find out that SELECT INTO in SQL is different from SELECT INTO in pgsql.
The former accepts TEMP as the parameter, the latter expects a variable to store some value.

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