| From: | Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl> | 
|---|---|
| To: | Angel Vicente Perez <angel(dot)vicente(at)knipping(dot)es> | 
| Cc: | pgsql-ayuda(at)tlali(dot)iztacala(dot)unam(dot)mx | 
| Subject: | Re: [Pgsql-ayuda] Procedimientos almacenados | 
| Date: | 2003-03-10 15:57:01 | 
| Message-ID: | 20030310155701.GG2042@dcc.uchile.cl | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-es-ayuda | 
On Mon, Mar 10, 2003 at 02:02:07PM +0100, Angel Vicente Perez wrote:
> CREATE FUNCTION public.dos() RETURNS public."Patrones" AS 'SELECT * FROM
> "Patrones" AS RESULT;'  LANGUAGE 'sql' VOLATILE;
> 
> Pero cuando la invoco con SELECT Dos() dice :
> 
> Cannot display a value of type RECORD
Welcome to psql 7.4devel, the PostgreSQL interactive terminal.
Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit
alvh=> create table patrones (uno int, dos text);
CREATE TABLE
alvh=> insert into patrones values (1, 'uno');
INSERT 18665 1
alvh=> insert into patrones values (2, 'dos');
INSERT 18667 1
alvh=> create function dos() returns setof patrones as 'select * from
patrones as result' language 'sql' volatile;
CREATE FUNCTION
alvh=> select * from dos() as blah(int, text);
 int | text
-----+------
   1 | uno
   2 | dos
(2 rows)
alvh=> select * from dos() as patrones;
 uno | dos
-----+-----
   1 | uno
   2 | dos
(2 rows)
-- 
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Cada quien es cada cual y baja las escaleras como quiere" (JMSerrat)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alvaro Herrera | 2003-03-10 16:01:14 | Re: [Pgsql-ayuda] No me realiza las consultas | 
| Previous Message | Jose Ayala - INCALPACA TPX | 2003-03-10 15:56:13 | [Pgsql-ayuda] cabecera detalle y autonumerico |