RE: CREATE OR REPLACE FUNCTION

From: Estéfano Castillo <ecastillo(at)crecic(dot)cl>
To: "'Mariela Martinez'" <mmartinez(at)movilmaster(dot)cl>
Cc: <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: RE: CREATE OR REPLACE FUNCTION
Date: 2004-10-13 20:56:47
Message-ID: 200410132057.i9DKv3o21218@crecicweb.crecic.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Prueba con este ejemplo(está adaptado a tu función por ende debieras llegar
y ejecutarlo), puesto que en plpgsql la consulta por si sola no te retorna
datos...debes usar una variable rowtype y luego con un loop retornar los
registros.

CREATE OR REPLACE FUNCTION selectcalles(text, text) RETURNS callesstgo AS
'DECLARE
res text;
v_retval callesstgo%ROWTYPE;
BEGIN
FOR v_retval IN
select * from callesstgo where distance(GeometryFromText(''POINT('' ||
$1 || '' '' || $2 || '') '',-1),the_geom) < 25;
LOOP
RETURN NEXT v_retval;
END LOOP;
RETURN;
END;'
LANGUAGE 'plpgsql' VOLATILE;

Estéfano Ariel Castillo Estrada
Técnico Universitario en Computación e Informática
Analista Programador de Sistemas CRECIC S.A.
Fono: (56)(41)240002 - Anexo 724
Celular: 93850119
Concepción - Chile

-----Mensaje original-----
De: pgsql-es-ayuda-owner(at)postgresql(dot)org
[mailto:pgsql-es-ayuda-owner(at)postgresql(dot)org] En nombre de Mariela Martinez
Enviado el: Miércoles, 13 de Octubre de 2004 10:45
Para: pgsql-es-ayuda(at)postgresql(dot)org
Asunto: [pgsql-es-ayuda] CREATE OR REPLACE FUNCTION

Por favor, necesito ayuda con esta función:

CREATE OR REPLACE FUNCTION selectcalles(text, text) RETURNS callesstgo AS
'DECLARE
res text;
BEGIN
select * from callesstgo where distance(GeometryFromText(''POINT('' ||
$1
|| '' '' || $2 || '') '',-1),the_geom) < 25; END;'
LANGUAGE 'plpgsql' VOLATILE;

Necesito traer un conjunto de registros, pero cuando la ejecuto me trae el
siguiente error:
ERROR: SELECT query has no destination for result data.
If you want to discard the results, use PERFORM instead.

Estoy trabajando con PostGreSQL 7.3

---------------------------(end of broadcast)---------------------------
TIP 9: el optimizador ignorará el uso de recorridos de índice si los
tipos de datos de las columnas no coinciden

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message angel Iracheta 2004-10-13 23:16:36 Re: Sumar Dias a una Fecha
Previous Message Leonel Nunez 2004-10-13 20:51:02 Re: Migrar mi data a otro Linux