pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ing. Jhon Carrillo <jdigital@cantv.net>
To: pgsql-hackers@postgresql.org
Cc: pgsql-sql@postgresql.org
Subject: Function .. AS..?
Date: Wed, 9 Feb 2005 16:57:14 -0400
Message-ID: <014201c50ee9$eee0dcd0$1400a8c0@tgusta2> (raw)

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;

view thread (3+ messages)  latest in thread

Message-ID: <014201c50ee9$eee0dcd0$1400a8c0@tgusta2>
Permalink:  ../014201c50ee9$eee0dcd0$1400a8c0@tgusta2/
Also on:    postgresql.org/message-id/014201c50ee9$eee0dcd0$1400a8c0@tgusta2

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jdigital@cantv.net, pgsql-hackers@postgresql.org
  Subject: Re: Function .. AS..?
  In-Reply-To: <014201c50ee9$eee0dcd0$1400a8c0@tgusta2>

* 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