Re: [Probablemente Spam] ERROR: SET TRANSACTION ISOLATION LEVEL debe ser llamado antes de cualquier consulta?

From: Gilberto Castillo Martínez <gilberto(dot)castillo(at)etecsa(dot)cu>
To: Manuel Pernalete <mpernaletetorres(at)gmail(dot)com>
Cc: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: [Probablemente Spam] ERROR: SET TRANSACTION ISOLATION LEVEL debe ser llamado antes de cualquier consulta?
Date: 2009-01-07 21:24:39
Message-ID: 1231363479.29402.14.camel@gilbertoc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

El jue, 08-01-2009 a las 16:27 +0000, Manuel Pernalete escribió:
> Hola a todos amigos de la lista de postgres.. tengo varios dias
> googleando y no consigo solucion al problema. Este el es codigo de mi
> funcion:
> *********************************************************************
> CREATE OR REPLACE FUNCTION asignar_colarac(id_proceso int4,id_analista
> int4,id_rac int4)
> RETURNS void AS $$
>
> DECLARE
> nrocola int8;
> priori int4;
> ofic racoficinas%ROWTYPE;
> proc procesos%ROWTYPE;
>
> BEGIN
> SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
>
> SELECT INTO ofic * FROM racoficinas WHERE id = $3;
> SELECT INTO proc * FROM procesos WHERE id = $1;
> nrocola := ofic.ultnumcola;
> IF nrocola = 0 THEN
> nrocola := 1;
> ELSE
> nroCola := nroCola + 1;
> END IF;
>
> IF proc.codedoproc = 'PN' THEN
> priori := 0;
> ELSE
> IF ofic.id = 1 THEN
> priori := 2;
> ELSE
> priori := 1;
> END IF;
> END IF;
>
> UPDATE procesos SET racoficina_id = $3, numCola = nrocola,
> prioridad = priori WHERE id = $1;
> UPDATE racoficinas SET ultnumcola = nroCola WHERE id = $3;
>
> COMMIT;
> END;
>
> $$ LANGUAGE 'plpgsql';
> *********************************************************************
> Como ven el SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; esta despues
> del BEGIN. Lo hice como dicen en los manuales de postgres que me he
> conseguido...
Según noto el Begin-end en de la función ... creo que si colocas en
begin y en para la transacción no de problemas.
> entonces cuando ejecuto la funcion ===> select asignar_colarac(9, 66,
> 2);
> me da el siguiente error:
>
> ERROR: SET TRANSACTION ISOLATION LEVEL debe ser llamado antes de
> cualquier consulta
> CONTEXT: sentencia SQL: «SET TRANSACTION ISOLATION LEVEL
> SERIALIZABLE»
> PL/pgSQL function "asignar_colarac" line 9 at SQL statement
>
>
>
>
>
>
>
> --
> Atentamente,
> Ing. Manuel Pernalete
> Soluciones Informáticas MWP, C.A.
> 0412-510.94.09 / 0414-352.68.72 / 0416-359.34.18

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Alvaro Herrera 2009-01-07 22:04:22 Re: ERROR: SET TRANSACTION ISOLATION LEVEL debe ser llamado antes de cualquier consulta?
Previous Message Manuel Pernalete 2009-01-07 21:17:50 RROR: SET TRANSACTION ISOLATION LEVEL debe ser llamado antes de cualquier consulta