From: | Victor Lopez <v(dot)lopez(dot)s(at)ono(dot)com> |
---|---|
To: | pgsql-es-ayuda(at)postgresql(dot)org |
Subject: | Re: EXECUTE en PL/pgSQL ¿? o 'como me lio' |
Date: | 2007-04-01 19:21:04 |
Message-ID: | 200704012121.04377.v.lopez.s@ono.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
El Domingo, 01 de Abril de 2007 19:02, Alvaro Herrera nos dijo ...:
>
> En el lenguaje sql, no existe EXECUTE. Prueba con plpgsql.
>
> --
> Alvaro Herrera http://www.CommandPrompt.com/
> The PostgreSQL Company - Command Prompt, Inc.
>
test=# CREATE OR REPLACE FUNCTION prueba(TEXT) RETURNS boolean AS
test-# $$
test$# DECLARE
test$# R boolean;
test$# BEGIN
test$# EXECUTE 'SELECT (count(*)::integer > 0) FROM ' || $1 INTO R;
test$# RETURN R;
test$# END;
test$# $$
test-# LANGUAGE plpgsql;
CREATE FUNCTION
test=# select prueba('test');
prueba
--------
f
(1 fila)
Gracias ... no me había dado cuenta.
--
----o---( )---o----
Saludos de Victor Lopez Sabio
v(dot)lopez(dot)s(at)ono(dot)com
--------oooo--------
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2007-04-01 20:01:38 | Re: ayuda Zeos y postgres II |
Previous Message | Alvaro Herrera | 2007-04-01 17:02:38 | Re: EXECUTE en PL/pgSQL ¿? o 'como me lio' |