Re: [pgsql-es-ayuda] Re: [pgsql-es-ayuda] ayuda con función

From: Juan <smalltalker(dot)marcelo(at)gmail(dot)com>
To: Virginia <mavir78(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Ayuda <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: [pgsql-es-ayuda] Re: [pgsql-es-ayuda] ayuda con función
Date: 2011-08-12 18:42:55
Message-ID: CAKizN9ycmQZgthNNXhXMR4BJOL+17qa_qZDhDNoxdvpwM1a=bw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Virginia

CREATE OR REPLACE FUNCTION calculo_distancia(numeric, numeric, numeric, numeric)
RETURNS integer AS

El numero del resultado seguramente excede el integer no es integer
es mas grande seguramente
en

CREATE OR REPLACE FUNCTION calculo_distancia(numeric, numeric, numeric, numeric)
RETURNS double AS

podria andar sino evalualo en pfgadmin fijate que tipo te da el
resultado ponelo en la funcion ( el tipo)
salu2
mdc
2011/8/12 Virginia <mavir78(at)gmail(dot)com>:
> Hola!!!
> Cambié el AS por INTO y me da el siguiente error
>
>
> ERROR:  invalid input syntax for integer: "2.34898380940343"
> CONTEXT:  PL/pgSQL function "calculo_distancia" while casting return value
> to function's return type
>
> ********** Error **********
>
> ERROR: invalid input syntax for integer: "2.34898380940343"
> SQL state: 22P02
> Context: PL/pgSQL function "calculo_distancia" while casting return value to
> function's return type
>
>
>
>
>
> El 12 de agosto de 2011 12:45, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
> escribió:
>>
>> Excerpts from Virginia's message of vie ago 12 12:28:36 -0400 2011:
>>
>> > BEGIN
>> >     SELECT (acos(sin(radians(LATITUD_1)) * sin(radians(LATITUD_2)) +
>> >     cos(radians(LATITUD_1)) * cos(radians(LATITUD_2)) *
>> >     cos(radians(LONGITUD_1) - radians(LONGITUD_2))) * 6378) as
>> > resultado;
>> >     RETURN resultado;
>>
>> Usa INTO, no AS.
>>
>> --
>> Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
>
>

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Rodrigo Gonzalez 2011-08-12 18:46:54 Re: [pgsql-es-ayuda] Re: [pgsql-es-ayuda] ayuda con función
Previous Message Virginia 2011-08-12 18:38:48 Re: [pgsql-es-ayuda] ayuda con función