0
点赞
收藏
分享

微信扫一扫

postgres 判断查询结果集为空,判断查出出来的记录为零

愚鱼看书说故事 2022-08-02 阅读 176
  1. 使用exsits 如下:

do
$$
begin
if exists(select * from res_partner where 1!=1) then
raise notice 'ererrrr';
end if;
end;
$$;

  1. 还有一种比较蠢的方法:使用​​count​​ 来获取返回的结果,然后判断count的值是否为零.

懂得,原来世界如此简单!



举报

相关推荐

0 条评论