X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 182CD8B9FB6; Wed, 9 Feb 2005 20:57:26 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 41089-08; Wed, 9 Feb 2005 20:57:09 +0000 (GMT) Received: from rs25s3.datacenter.cha.cantv.net (rs25s3.datacenter.cha.cantv.net [200.44.33.4]) by svr1.postgresql.org (Postfix) with ESMTP id D60418BA076; Wed, 9 Feb 2005 20:57:05 +0000 (GMT) Received: from tgusta2 (dC9F37E9A.dslam-14-24-3-06-01-02.fsl.dsl.cantv.net [201.243.126.154]) by rs25s3.datacenter.cha.cantv.net (8.13.0/8.13.0/3.0) with SMTP id j19Kv3m4021992; Wed, 9 Feb 2005 16:57:04 -0400 X-Matched-Lists: [] Message-ID: <014201c50ee9$eee0dcd0$1400a8c0@tgusta2> Reply-To: "Ing. Jhon Carrillo" From: "Ing. Jhon Carrillo" To: Cc: Subject: Function .. AS..? Date: Wed, 9 Feb 2005 16:57:14 -0400 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_013F_01C50EC8.67581100" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Virus-Scanned: ClamAV version 0.81, clamav-milter version 0.81b on rs25s3.datacenter.cha.cantv.net X-Virus-Status: Clean X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.312 tagged_above=0 required=5 tests=AWL, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200502/348 X-Sequence-Number: 64176 This is a multi-part message in MIME format. ------=_NextPart_000_013F_01C50EC8.67581100 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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,=20 cont_idpers varchar, cont_nombre varchar, cont_apellido varchar, cont_titulo varchar, cont_fecnac timestamp , cont_codedociv integer, cont_sexo char(1),=20 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_sex= o,cont_codpais,cont_pw,cont_empr,cont_cargo,cont_pwempr,cont_aniv,cont_pr= of,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; ------=_NextPart_000_013F_01C50EC8.67581100 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Those instructions are good but i = want  to=20 call this function  only  for  " select =20 consulta_contacto(1)"  nothing more,  Is really necesary to = use=20  "AS ..."?
 
this is  the call:
 
 
select * from  = consulta_contacto(1) as=20 (cont_codigo      integer,=20
           &nb= sp;           &nbs= p;            = ;   =20 cont_idpers     =20 varchar,
          &= nbsp;           &n= bsp;           &nb= sp;    =20 cont_nombre     =20 varchar,
          &= nbsp;           &n= bsp;           &nb= sp;    =20 cont_apellido   =20 varchar,
          &= nbsp;           &n= bsp;           &nb= sp;    =20 cont_titulo     =20 varchar,
          &= nbsp;           &n= bsp;           &nb= sp;    =20 cont_fecnac      timestamp=20 ,
           &n= bsp;           &nb= sp;           &nbs= p;   =20 cont_codedociv  =20 integer,
          &= nbsp;           &n= bsp;           &nb= sp;    =20 cont_sexo        char(1),=20
           &nb= sp;           &nbs= p;            = ;   =20 cont_codpais    =20 integer,
          &= nbsp;           &n= bsp;           &nb= sp;    =20 cont_pw         =20 varchar,
          &= nbsp;           &n= bsp;           &nb= sp;    =20 cont_empr       =20 varchar,
          &= nbsp;           &n= bsp;           &nb= sp;    =20 cont_cargo      =20 varchar,
          &= nbsp;           &n= bsp;           &nb= sp;    =20 cont_pwempr     =20 varchar,
          &= nbsp;           &n= bsp;           &nb= sp;    =20 cont_aniv       =20 char(5),
          &= nbsp;           &n= bsp;           &nb= sp;    =20 cont_prof       =20 varchar,
          &= nbsp;           &n= bsp;           &nb= sp;    =20 cont_trab       =20 char(1),
          &= nbsp;           &n= bsp;           &nb= sp;    =20 cont_fecgen     =20 timestamp,
          = ;            =             &= nbsp;    =20 cont_fecing     =20 timestamp,
          = ;            =             &= nbsp;    =20 cont_fuente     =20 char(1),
          &= nbsp;           &n= bsp;           &nb= sp;    =20 cont_sinc       =20 char(1),
          &= nbsp;           &n= bsp;           &nb= sp;    =20 cont_codupload   integer);
 
this is the function:
 

CREATE OR REPLACE FUNCTION=20 consulta_contacto(integer) RETURNS SETOF RECORD AS = '
DECLARE
  =20 rec RECORD;
   sup INTEGER;
BEGIN
   FOR = rec IN=20 SELECT cont_codigo,cont_idpers,=20 cont_nombre,cont_apellido,cont_titulo,cont_fecnac,cont_codedociv,cont_sex= o,cont_codpais,cont_pw,cont_empr,cont_cargo,cont_pwempr,cont_aniv,cont_pr= of,cont_trab,cont_fecgen,cont_fecing,cont_fuente,cont_sinc,cont_codupload=
     =20 FROM tbu_contacto
    =20 LOOP
       RETURN NEXT rec=20 ;
     END LOOP;
   RETURN = ;
END;
'=20 LANGUAGE plpgsql;
------=_NextPart_000_013F_01C50EC8.67581100--