EXCEPTION WHEN DUP_VAL_ON_INDEX THEN
dup_prod_limt_info := 'An error ocurred trying to inset a record into FICS_CLM.T_CLM_CPARTY_PROD_LMT with CPARTY_PROD_LIMIT_TXN_ID <' || max_limit_txn_id ||
'> CPARTY_ID <' || pro_lim_rec.CPARTY_ID || '> BU_LVL4_CODE <' || pro_lim_rec.BU_LVL4_CODE || '> PROD_CODE <' || pro_lim_rec.PROD_CODE || '>';
RAISE dup_prod_limit;
答案 0 :(得分:0)
您可以在EXCEPTION BLOCK
中使用RAISE EXCEPTION子句示例:
DECLARE
mensaje text;
mensaje_detalle text;
sqlerror text;
begin
--do something;
EXCEPTION
WHEN syntax_error THEN
RAISE EXCEPTION 'sintaxis error';
--for unknown exception
WHEN OTHERS THEN
GET STACKED DIAGNOSTICS mensaje = message_text, mensaje_detalle =
pg_exception_detail, sqlerror = returned_sqlstate;
RAISE EXCEPTION 'other error: %, %, %', sqlerror, mensaje,mensaje_detalle;
END;