Detalle en: CREATE LOCAL TEMP TABLE...

From: Jesus Gustavo Macias Barba <jgmacias(at)tutopia(dot)com>
To: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Detalle en: CREATE LOCAL TEMP TABLE...
Date: 2004-10-20 21:06:47
Message-ID: 1098306406.9623.21.camel@gustavo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda


Hola a todos:

Dentro de una funcion 'plpgsql' estoy creando unas tablas temporales, al
final de la funcion las elimino con drop table; a la segunda vez que
corro la funcion me marca un error la funcion.(vea "Ejemplo de la
funcion"), Segun la funcion...¿Se puede crear una tabla temporal de otra
tabla tempral???(vea: "Line: 55" del ejemplo)...o ¿Por que sale este
error? (vea "Mensaje de Error:")

Ejemplo de la funcion:
---------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION
sai_orpr_dv (int,int,int,int, int,int, int,int, int,int,int,int,int,int)
RETURNS integer AS '
DECLARE
r_record record;
...
BEGIN
CREATE LOCAL TEMP TABLE tmp_tabla1 AS
SELECT * FROM tabla_fija_1 WHERE...;

CREATE LOCAL TEMP TABLE tmp_tabla2 AS <<<-- Line: 55 <<<--
SELECT campo1,campo2 FROM tmp_tabla1 WHERE...;

CREATE LOCAL TEMP TABLE tmp_tabla3 AS
SELECT * FROM tabla_fija_2 WHERE...;

FOR r_record IN SELECT...
LOOP
---
---
END LOOP;

DROP TABLE tmp_tabla1;
DROP TABLE tmp_tabla2;
DROP TABLE tmp_tabla3;

RETURN 1;
END;
' LANGUAGE 'plpgsql';
---------------------------------------------------------------------------

Mensaje de Error:
---------------------------------------------------------------------------
csn09=# select sai_orpr_dv(030201,030215,30002,31502,90,180,181,270,271,
360,361,720,721,0);
WARNING: Error occurred while executing PL/pgSQL function sai_orpr_dv
WARNING: line 55 at SQL statement
ERROR: pg_class_aclcheck: relation 47465457 not found
---------------------------------------------------------------------------

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Carlos Chavez Herrera 2004-10-20 21:52:54 manual
Previous Message Martín Marqués 2004-10-20 20:53:58 Re: script mysql2pgsql