I'm converting plsql to PostgreSQL. In plsql:
declare
W_USR_EXCE EXCEPTION;
......
raise W_USR_EXCE;
I have converted in PostgreSQL like this
IF (W_DAY_TOTAL_AMT > W_NEW_LIMIT) THEN
W_ERR_MSG := 'Exceeds Benificiary Limit';
RETURN EXCEPTION USING ERRCODE = '50011';
if "if" condition executed am getting "W_ERR_MSG" message along with that i need EXCEPTION to return
but it is not returning any value. Please help me to solve this error.
CodePudding user response:
Just for reference you can use the below psudo code to raise any error message in POSTGRESQL :
RAISE EXCEPTION 'Nonexistent ID --> %', user_id
USING HINT = 'Please check your user ID';
follow the link for more details : https://www.postgresql.org/docs/current/plpgsql-errors-and-messages.html