如何在pgAdmin中执行pgsql脚本? [英] how to execute pgsql script in pgAdmin?

查看:932
本文介绍了如何在pgAdmin中执行pgsql脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想直接从 pgAdmin 编辑器UI执行一些 pgScript .

I want to execute some pgScript directly from the pgAdmin editor UI.

FOR i IN 1..10 LOOP
   PRINT i; -- i will take on the values 1,2,3,4,5,6,7,8,9,10 within the loop
END LOOP;

但是我总是得到

[ERROR    ] 1.0: syntax error, unexpected character

我还尝试使用 do $$ ... $$ 包装代码,但不能解决问题.

I also tried to wrap the code with do$$...$$, but does not solve the problem.

推荐答案

除了 Clodoaldo Neto的答案.您可以尝试这也是

apart from Clodoaldo Neto's Answer.You can try this also

DO
$$
BEGIN
 FOR i IN 1..10 LOOP
       RAISE NOTICE '%', i; -- i will take on the values 1,2,3,4,5,6,7,8,9,10 within the loop
 END LOOP;
END
$$

这篇关于如何在pgAdmin中执行pgsql脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆