加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

postgresql – 使用exec而不是select来调用函数

发布时间:2020-12-13 16:40:19 所属栏目:百科 来源:网络整理
导读:是从my_function()中调用函数select *的默认方式吗? 我问,因为我已经建立了一个不返回任何东西的函数,只需将数据插入到一个表中(来自SQL Server的后台),就可以使用select * from …来感觉奇怪 我期待着像exec my_function() 使用PERFORM语句 – http://w
是从my_function()中调用函数select *的默认方式吗?

我问,因为我已经建立了一个不返回任何东西的函数,只需将数据插入到一个表中(来自SQL Server的后台),就可以使用select * from …来感觉奇怪

我期待着像exec my_function()

使用PERFORM语句 – http://www.postgresql.org/docs/current/static/plpgsql-statements.html

Sometimes it is useful to evaluate an expression or SELECT query but
discard the result,for example when calling a function that has
side-effects but no useful result value. To do this in PL/pgSQL,use
the PERFORM statement

所以只是

DO $$ BEGIN
    PERFORM my_function();
END $$;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读