'PROCEDURE' postgresql 附近的语法不正确 [英] Incorrect syntax near 'PROCEDURE' postgresql
本文介绍了'PROCEDURE' postgresql 附近的语法不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的数据库托管在 Amazon 中,我使用 pgAdmin 4 连接到它.我从
做错了什么?不知道我如何检查 postgresql 本身的版本
解决方案
使用 Postgres 10,你需要使用一个函数:
CREATE 函数 insert_data(a integer, b integer)返回无效语言 SQL作为 $$插入 tbl 值 (a), (b);$$;
My database is hosted in Amazon and I am using pgAdmin 4 to connect to it. I copy-pasted snippet from https://www.postgresql.org/docs/11/sql-createprocedure.html
CREATE PROCEDURE insert_data(a integer, b integer)
LANGUAGE SQL
AS $$
INSERT INTO tbl VALUES (a);
INSERT INTO tbl VALUES (b);
$$;
The issue is that I get 'incorrect syntax near 'PROCEDURE' ' error
What is done wrong? Not sure how I check version of postgresql itself
解决方案
With Postgres 10, you need to use a function:
CREATE function insert_data(a integer, b integer)
returns void
LANGUAGE SQL
AS $$
INSERT INTO tbl VALUES (a), (b);
$$;
这篇关于'PROCEDURE' postgresql 附近的语法不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文