postgres 判斷查詢結果集為空,判斷查出出來的記錄為零


  1. 使用exsits 如下:
do
$$
    begin
    if exists(select * from res_partner where 1!=1) then
        raise notice 'ererrrr';
    end if;
    end;
$$;
  1. 還有一種比較蠢的方法:使用count 來獲取返回的結果,然后判斷count的值是否為零.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM