I have the following stored procedure that executes several queries to different tables
CREATE PROCEDURE "informix".pr_ventasVsSaldos ()
This is executed for client database which handle a lot of data. Sometimes because of the volume of data it generates blocking errors.
Is there any way to validate that when an error is generated in some of the queries I can perform an update? This is because when the procedure is executed it is because previously in a table a parameter is sent in 1 and this blocks a button of x
form so that no more requests are sent while it is already running. When the procedure is finished, the system updates the parameter.
UPDATE ventas_saldos SET sw_genera_consulta=0
WHERE sw_genera_consulta=1;
I want to have the form that if there is an error in any of the queries do the same so that the form is again enabled.
I tried it in the following way but it does not work for me, with the function RAISE EXCEPTION
, if it generates an error that makes the update indicated
ON EXCEPTION SET esql, eisam, estring
ROLLBACK WORK;
RAISE EXCEPTION esql, eisam, estring;
UPDATE ventas_saldos SET sw_genera_consulta=0
WHERE sw_genera_consulta=1;
RETURN 0;
END EXCEPTION
There is some other way to have this control.