如何在postgresql中声明异常?

如何在postgresql中声明异常?,postgresql,Postgresql,甲骨文: PostgreSQL中的等价物是什么?您不需要在PostgreSQL中声明它们。您可以通过它们的条件名称、类别名称、SQLSTATE或特殊的OTHERS。 DECLARE Child_rec_exception EXCEPTION; PRAGMA EXCEPTION_INIT (Child_rec_exception, -2292); BEGIN Delete FROM product where product_id= 104; EXCEPTION

甲骨文:


PostgreSQL中的等价物是什么?

您不需要在PostgreSQL中声明它们。您可以通过它们的条件名称、类别名称、SQLSTATE或特殊的
OTHERS
DECLARE 
  Child_rec_exception EXCEPTION; 
  PRAGMA 
   EXCEPTION_INIT (Child_rec_exception, -2292); 
BEGIN 
  Delete FROM product where product_id= 104; 
EXCEPTION 
   WHEN Child_rec_exception 
   THEN Dbms_output.put_line('Child records are present for this product_id.'); 
END;