catch runtime errors - Mailing list pgsql-novice

From Robert Wimmer
Subject catch runtime errors
Date
Msg-id BAY10-F501BF8D0481F8D6D3A4D11D0BF0@phx.gbl
Whole thread Raw
Responses Re: catch runtime errors
List 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 by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: remove too much space between words of the string
Next
From: Steve Tucknott
Date:
Subject: Data directory copies...