Re: exceptions
| От | Michael Fuhr |
|---|---|
| Тема | Re: exceptions |
| Дата | |
| Msg-id | 20051011183321.GA99188@winnie.fuhr.org обсуждение исходный текст |
| Ответ на | Re: exceptions ("Rafael Montoya" <rafo-mm@hotmail.com>) |
| Ответы |
Windows Installation error
|
| Список | pgsql-general |
On Tue, Oct 11, 2005 at 07:24:12PM +0200, Rafael Montoya wrote: > I'm migrating some triggers from oracle to postgresql and i can´t find the > equivalent of the following two sentences: > 1) > DECLARE > TMP_COD_PRO PRODUCT.COD_PRO%TYPE; See "Declarations" in the PL/pgSQL documentation for the available syntax: http://www.postgresql.org/docs/8.0/interactive/plpgsql-declarations.html > 2) > EXCEPTION > when no_data_found then null; > > what i tried : > > exception > if not found then null; > > but it seems not to be correct, can anybody give me a hand? See "Trapping Errors" in the documentation for the allowed syntax (only available in 8.0 and later): http://www.postgresql.org/docs/8.0/interactive/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING In PL/pgSQL, queries that return no rows don't raise a "no data" exception. To check whether any rows were returned you can use FOUND in an ordinary IF statement. -- Michael Fuhr
В списке pgsql-general по дате отправления: