插入在存储过程中不起作用的温度表中
该脚本在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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我发现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.