Hi,
On Monday 11 June 2007 13:45, Pit M. wrote:
| Assume a user doing a query which shall select all customers having a
| ZIP in [10000;20000[ by using a CAST. If the cursor now fetches the row
| with ID 4 we get an error (invalid input syntax) as "A1234" cannot be
| casted as integer. This is ok, BUT now all further FETCH commands fail
| with "current transaction is aborted"!
|
| How can we resume from there with FETCH commands (e.g. at least FETCH
| FIRST)? We cannot avoid the (first) error itself, as the user can enter
| any WHERE condition at runtime. Therefore we must handle the error - if
| any - and resume from there properly.
I didn't try myself, but wrapping the whole into a PL/pgSQL function and
using exceptions might do the work;
http://www.postgresql.org/docs/8.2/static/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING
Ciao,
Thomas
--
Thomas Pundt <thomas.pundt@rp-online.de> ---- http://rp-online.de/ ----