| From: | "Ing(dot) Jhon Carrillo" <jdigital(at)cantv(dot)net> | 
|---|---|
| To: | <pgsql-hackers(at)postgresql(dot)org> | 
| Cc: | <pgsql-sql(at)postgresql(dot)org> | 
| Subject: | Function .. AS..? | 
| Date: | 2005-02-09 20:57:14 | 
| Message-ID: | 014201c50ee9$eee0dcd0$1400a8c0@tgusta2 | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers pgsql-sql | 
Those instructions are good but i want to call this function only for " select consulta_contacto(1)" nothing more, Is really necesary to use "AS ..."?
this is the call:
select * from  consulta_contacto(1) as (cont_codigo      integer, 
                                        cont_idpers      varchar,
                                        cont_nombre      varchar,
                                        cont_apellido    varchar,
                                        cont_titulo      varchar,
                                        cont_fecnac      timestamp ,
                                        cont_codedociv   integer,
                                        cont_sexo        char(1), 
                                        cont_codpais     integer,
                                        cont_pw          varchar,
                                        cont_empr        varchar,
                                        cont_cargo       varchar,
                                        cont_pwempr      varchar,
                                        cont_aniv        char(5),
                                        cont_prof        varchar,
                                        cont_trab        char(1),
                                        cont_fecgen      timestamp,
                                        cont_fecing      timestamp,
                                        cont_fuente      char(1),
                                        cont_sinc        char(1),
                                        cont_codupload   integer);
this is the function:
CREATE OR REPLACE FUNCTION consulta_contacto(integer) RETURNS SETOF RECORD AS '
DECLARE
   rec RECORD;
   sup INTEGER;
BEGIN
   FOR rec IN SELECT cont_codigo,cont_idpers, cont_nombre,cont_apellido,cont_titulo,cont_fecnac,cont_codedociv,cont_sexo,cont_codpais,cont_pw,cont_empr,cont_cargo,cont_pwempr,cont_aniv,cont_prof,cont_trab,cont_fecgen,cont_fecing,cont_fuente,cont_sinc,cont_codupload
      FROM tbu_contacto
     LOOP
       RETURN NEXT rec ;
     END LOOP;
   RETURN ;
END;
' LANGUAGE plpgsql;
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2005-02-09 23:05:39 | Re: libpq API incompatibility between 7.4 and 8.0 | 
| Previous Message | Gavin M. Roy | 2005-02-09 19:41:19 | Re: PHP/PDO Database Abstraction Layer | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Stephan Szabo | 2005-02-10 06:06:07 | Re: Function .. AS..? | 
| Previous Message | Tom Lane | 2005-02-09 20:51:01 | Re: parsing a string with a hexadecimal notation |