update ... current of

From: "Juan Carlos Barranco de Paz" <jcb(at)greccosoft(dot)es>
To: <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: update ... current of
Date: 2008-06-17 17:56:44
Message-ID: 000c01c8d0a3$813e4e90$83baebb0$@es
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Hola , he instalado la 8.3, estoy intentando hacer un update a través de un
cursor, nueva característica que incorpora esta versión.

Ya he conseguido que no me de error a la hora de cargar, pero si me da a la
hora de ejecutar.

Este es el error

ERROR: el cursor «<unnamed portal 1>» no es un recorrido simplemente
actualizable de la tabla «dw21vent»
Estado SQL:24000
Contexto:sentencia SQL: «update dw21vent set beneficio_ult = 1 where current
of $1 »
PL/pgSQL function "dw0_0012_1" line 97 at SQL statement
sentencia SQL: «SELECT dw0_0012_1( $1 )»
PL/pgSQL function "dw0_0012" line 22 at PERFORM

Esta es la function n si

CREATE OR REPLACE FUNCTION dw0_0012_1(dw01 dw01conf)
RETURNS smallint AS
$BODY$
DECLARE

dw0_0012_1_c refcursor;
dw21 dw21vent%ROWTYPE;
BEGIN
OPEN dw0_0012_1_c FOR SELECT
*
from dw21vent
where empresa = dw01.empresa
order by 1,2,3
;

LOOP
FETCH dw0_0012_1_c INTO dw21;
EXIT WHEN NOT FOUND;

update dw21vent set beneficio_ult = beneficio_ult + 1
where current of dw0_0012_1_c;

END LOOP;

CLOSE dw0_0012_1_c;

RETURN 1;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Alvaro Herrera 2008-06-17 19:01:46 Re: update ... current of
Previous Message Alvaro Herrera 2008-06-17 17:21:57 Re: Replicación Centralizada con Slony