DECLARE
>>
>>
>> v_msg TEXT := '''SOMETHING IS WRONG''';
>>
>> v_sqlstate TEXT := '''E0001''';
>>
>> v1 TEXT ;
>>
>>
>> BEGIN
>>
>> v1 := v_msg || ' USING errcode = ' || v_sqlstate;
>>
>> RAISE NOTICE '%', v1;
>>
>> RAISE EXCEPTION '%', v1;
>>
>>
>> EXCEPTION
>>
>> WHEN SQLSTATE 'E0001'
mike davis writes:
> I'm trying to get dynamic version of the RAISE command working so
> that I can use a table of custom application error messages and codes
> for use by all developed plpgsql functions.
This works for me:
DO $$
DECLARE
v_msg TEXT := 'SOMETHING IS
2017-09-22 1:40 GMT+02:00 mike davis :
> I’m trying to get dynamic version of the RAISE command working so that I
> can use a table of custom application error messages and codes for use by
> all developed plpgsql functions. In this way the customer error codes and
>
I’m trying to get dynamic version of the RAISE command working so that I can
use a table of custom application error messages and codes for use by all
developed plpgsql functions. In this way the customer error codes and message
are not hard coded into code and are defined consistently in one