Re: Error al Crear Funcion Atravez de PHPPGADMIN

From: Julio Cesar Rodriguez Dominguez <jurasec(at)gmail(dot)com>
To: Patricio Cardenas Garay <pcardenas(at)colegiointeractivo(dot)com>
Cc: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: Error al Crear Funcion Atravez de PHPPGADMIN
Date: 2010-12-09 20:40:00
Message-ID: AANLkTik4tCP7wpbNo=wpYvAxXgr9FY_--EJ+tCPWxXQY@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

2010/12/9 Patricio Cardenas Garay <pcardenas(at)colegiointeractivo(dot)com>:
> SQL error:
>
> ERROR:  plpgsql functions cannot take type record
>
> In statement:
>
> CREATE FUNCTION "anosaprobados" (OUT x integer,OUT rdb1 integer,OUT id_ano1
> integer,OUT rut_alumno1 integer,OUT nombre_instit1 text,OUT nro_ano1
> integer,OUT cursoletra1 text,OUT RESPUESTA record) RETURNS SETOF record AS
> 'DECLARE
>
> RESPUESTA RECORD;
>
> rutingresado ALIAS FOR $1;
>
> BEGIN
>
>
>
>   FOR RESPUESTA IN (
>
>
>
>   SELECT
>
>   inst.rdb as insti,
>
>   pro.id_ano as id_ano,
>
>   pro.rut_alumno as rut_alumno,
>
>   inst.nombre_instit as nombreinstitucion,
>
>   anes.nro_ano as numero_ano,
>
>   cast(cu.grado_curso || ''-'' || cu.letra_curso as varchar(3)) as
> cursoletra
>
>   FROM promocion pro
>
>   inner join institucion inst on inst.rdb = pro.rdb
>
>   inner join ano_escolar anes on anes.id_ano = pro.id_ano
>
>   inner join matricula ma on ma.id_ano = pro.id_ano and ma.rut_alumno =
> rutingresado
>
>   inner join curso cu on cu.id_ano = anes.id_ano and cu.ensenanza > 110 and
> cu.id_curso = ma.id_curso
>
>   WHERE
>
>   pro.rut_alumno = rutingresado and pro.situacion_final = 1 and pro.promedio
>> 0 and pro.asistencia > 0
>
>   UNION
>
>   SELECT
>
>   0 as insti,
>
>   0 as id_ano,
>
>   conce.rut_alumno ,
>
>   conce.institucion,
>
>   conce.ano,
>
>   cast(conce.curso || ''-'' || conce.letra as varchar(3)) as cursoletra
>
>   FROM concentracion_notas conce where conce.rut_alumno = rutingresado
> order by numero_ano  DESC  )
>
>
>
>   LOOP
>
>       RETURN NEXT RESPUESTA;
>
>   END LOOP;
>
>
>
> RETURN;
>
> END;
>
> $body$
>
> LANGUAGE ''plpgsql''' LANGUAGE "plpgsql"
>
> VOLATILE
>
>
>
>
>
> Esta misma funcion la cree en otras bases de datos pero atraves del SQL
> Manager y ni tuve problemas aca nose porque no pesca el tipo record
>
> Si alguien me puede ayuadar por favor  muchas gracias
>
> Esta es mi primera funcion con postgreesql.
>
>
>
>

Solo quita el ultimo parámetro OUT que estas regresando (RESPUESTA)

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Guido Ojeda 2010-12-09 20:41:28 Re: No me conecta a bbdd postgresql 7.4 :-S
Previous Message Julio Cesar Rodriguez Dominguez 2010-12-09 20:34:51 Re: PL/PGSQL: Lanzar comandos del S.O.