catch runtime errors

Поиск
Список
Период
Сортировка
От Robert Wimmer
Тема catch runtime errors
Дата
Msg-id BAY10-F501BF8D0481F8D6D3A4D11D0BF0@phx.gbl
обсуждение исходный текст
Ответы Re: catch runtime errors  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice
hi,

is there a possibility to catch runtime errors in pgplsql function ? i did
not  find anything about this in the docs. what i want to do is to check all
values in a database function before doing any uptates or inserts.

for example (psudo code)

CREATE FUNCTION insert_xxx(TEXT,TEXT) RETURNS INT AS '
DECLARE id INTEGER;
  d DATE;
BEGIN
  -- check if $1 is integer
  id := CAST($1 AS INT);
  IF xxxError THEN RETURN -1; END IF;
  -- check if $2 is date
  d := CAST($2 AS DATE);
  IF xxxError THEN RETURN -2; END IF;
  ...
  RETURN 0;
END; '
......

i want to avoid to write different conversion tools for maybe php or java or
c or even VB. there is a function somewhere inside psql thats checking it -
because it causes a runtime error if something is wrong - why reinvent the
wheel (4 times!)  ?

bye and thanks

sepp

_________________________________________________________________
Schaffen Sie das Platzproblem in Ihrem E-Mail-Konto für immer aus der Welt!
http://join.msn.com/?pgmarket=de-at&DI=1031&XAPID=1581


В списке pgsql-novice по дате отправления:

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: remove too much space between words of the string
Следующее
От: Steve Tucknott
Дата:
Сообщение: Data directory copies...