From: David Calle <davydky@gmail.com>
To: pgsql-php@postgresql.org
Subject: Procedimientos con parametros
Date: Thu, 7 Aug 2008 12:16:12 -0500
Message-ID: <a354e4430808071016h2fb08cqbf0e181389797164@mail.gmail.com> (raw)
Hola amigos...
necesito una pequeña ayuda tengo el siguiente procedimento en postgres:
CREATE OR REPLACE FUNCTION consulta_parametros(IN float8, IN float8, OUT
out_propietario "varchar", OUT out_tipo "varchar") AS
$BODY$
DECLARE
fdistancia float(8);
ggeometria geometry;
BEGIN
SELECT DISTANCE(the_geom,SETSRID(makepoint($1,$2), 24877)), the_geom
INTO fdistancia, ggeometria
FROM recorrido
WHERE estado = 'V';
--out_distancia = fdistancia;
SELECT propietario, tipo
INTO out_propietario, out_tipo
FROM unidades a, recorrido
WHERE recorrido.the_geom = ggeometria;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION consulta_parametros(IN float8, IN float8, OUT out_propietario
"varchar", OUT out_tipo "varchar") OWNER TO postgres;
desde php cuando lo ejecuto no puedo filtrar el resultado x las columnas...
pues solo de devuelve el resultado como una sola cadena concatenada...
$sql="select consulta_parametros('$var1','$var2')";
$resultado=pg_exec($conn,$sql);
$row = pg_fetch_row($resultado, 0);
echo $row[0];
espero me puedan ayudar.. saludos..!
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: davydky@gmail.com
Subject: Re: Procedimientos con parametros
In-Reply-To: <a354e4430808071016h2fb08cqbf0e181389797164@mail.gmail.com>
References: <a354e4430808071016h2fb08cqbf0e181389797164@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox