Capturar errores SQLCODE en funcion

From: Gustavo Vaccaro <gustavo_vaccaro(at)fibertel(dot)com(dot)ar>
To: arpug(at)postgresql(dot)org
Subject: Capturar errores SQLCODE en funcion
Date: 2010-10-26 18:23:49
Message-ID: 4CC71CB5.4000805@fibertel.com.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: arpug

Hola,
Necesito utilizar el valor de SQLCODE (o SQLSTATE) dentro de una funcion
para establecer las acciones a seguir.
El ejemplo es:
*******************
begin
delete from tabla1 where.....;
case
when SQLCODE = 0 then ....;
when SQLCODE = 100 then ....;
etc..
end;
delete from tabla2 where.....;
case
when SQLCODE = 0 then ....;
when SQLCODE = 100 then ....;
etc..
end;
delete from tabla3 where.....;
idem anterior...
end
*******************

Lo unico que encontre es usar:
*******************
begin
begin
delete from tabla1 where.....;
exeption
when SQLCODE = 0 then ....;
when SQLCODE = 100 then ....;
end
begin
delete from tabla2 where.....;
exeption
when SQLCODE = 0 then ....;
when SQLCODE = 100 then ....;
end
end
*******************
Es decir tengo que anidar los begin/end.

En sybase puedo consultar el valor de SQLCODE o SQLSTATE como si fueran
variables. Ejemplo:
*******************
if SQLCODE = 0 or SQLCODE=100 then
......
end if;
*******************

¿Es posible hacer lo mismo en POSTGRES 8.4?

Saludos

--

Gustavo J. Vaccaro
http://www.gjv.com.ar

Browse arpug by date

  From Date Subject
Next Message Emanuel Calvo Franco 2010-10-29 08:28:14 [OT] Webcasts Gratuitos
Previous Message Mariano Reingart 2010-10-21 05:35:12 Jornadas Regionales 27/OCT/2010