Re: How to raise error from PostgreSql SQL statement if some condition is met

From: "Andrus" <kobruleht2(at)hot(dot)ee>
To: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to raise error from PostgreSql SQL statement if some condition is met
Date: 2012-08-12 07:31:42
Message-ID: DE497057158C4D718BEA60992B638573@dell2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Than you very much.
It worked.

I tried to extend it to pass message parameters. Tried code below but got
syntax error. How to pass message parameters ?

Andrus.

CREATE OR REPLACE FUNCTION RaiseException(text, variadic )
RETURNS void LANGUAGE plpgsql AS
$BODY$
BEGIN
RAISE EXCEPTION $1, $2;
END;
$BODY$;

SELECT RaiseException('Exception Param1=% Param2=%', 'textvalue', 2 );

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2012-08-12 09:12:07 Re: How to raise error from PostgreSql SQL statement if some condition is met
Previous Message Craig Ringer 2012-08-12 05:07:01 Re: How to raise error from PostgreSql SQL statement if some condition is met