From: | Perla <perla_bsas(at)yahoo(dot)com(dot)ar> |
---|---|
To: | pgsql-es-ayuda(at)postgresql(dot)org |
Subject: | se puede realizar COMMIT en una función? |
Date: | 2010-10-08 15:05:01 |
Message-ID: | 194068.39844.qm@web52901.mail.re2.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
Hola!
hice una función que realiza un UPDATE y quería hacer un COMMIT dentro de la función, pero me da el siguiente error:
ERROR: SPI_execute_plan failed executing query "commit": SPI_ERROR_TRANSACTION
CONTEXTO: PL/pgSQL function "cambia_clase" line 12 at sentencia SQL
La función es algo así:
CREATE FUNCTION cambia_clase() RETURNS VOID AS
$$
DECLARE
i INTEGER:= 0;
clasecorr CURSOR FOR select clasen,nro,mes from tmp_clase_correg;
BEGIN
FOR reg IN clasecorr LOOP
update tabla
set clasen = reg.clasen
where nro = reg.nro
and mes = reg.mes;
i := i + 1;
IF i = 1000 THEN
commit;
i := 0;
END if;
END LOOP;
END;
$$ LANGUAGE plpgsql;
Porqué me da error?
Gracias!
From | Date | Subject | |
---|---|---|---|
Next Message | Mariano Reingart | 2010-10-08 15:28:54 | Re: WebServices con Postgres y Perl |
Previous Message | David Samudio | 2010-10-08 11:28:57 | Re: WebServices con Postgres y Perl |