PostgreSQL
 sql >> Base de données >  >> RDS >> PostgreSQL

Conditions d'exception personnalisées PostgreSQL

begin
    if $1='bar' then
        raise exception using
            errcode='NOBAR',
            message='Bar is prohibited',
            hint='We do not talk to this guy';
    end if;
exception
    when sqlstate 'NOBAR' then
        update nobar_raised set count=count+1;
end;

Plus d'informations :