X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 43D5B11F60B3 for ; Sun, 9 Apr 2006 12:34:50 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: 0.12 X-Spam-Level: X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.119, HTML_MESSAGE=0.001] Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id GMZQLnToekS0 for ; Sun, 9 Apr 2006 12:34:44 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.188]) by postgresql.org (Postfix) with ESMTP id B8F4511F60E6 for ; Sun, 9 Apr 2006 12:34:44 -0300 (ADT) Received: by nproxy.gmail.com with SMTP id p77so486386nfc for ; Sun, 09 Apr 2006 08:34:43 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=ZdP+n4eoo9tRPsPTYes+QvYewmqYhFq3kAGz41VHfub3fGE9+qt3K9eD+a6LnuvUHN8M1JeoFGQF8G5hbAtE3Rw3CHwG1oL+mcAWk9wfyQg+hKmHChp66D2MWv03XTl5BlLSZ6UAR51nMxWJpwGuLCMIUyi/UFXhbVNrFmSbG5A= Received: by 10.49.3.14 with SMTP id f14mr1001273nfi; Sun, 09 Apr 2006 08:34:43 -0700 (PDT) Received: by 10.49.27.16 with HTTP; Sun, 9 Apr 2006 08:34:43 -0700 (PDT) Message-ID: Date: Sun, 9 Apr 2006 21:04:43 +0530 From: "Rajesh Kumar Mallah" To: "Chethana, Rao (IE10)" Subject: Re: pls reply ASAP Cc: theodoreloscalzo@mac.com, "Richard Huxton" , pgsql-performance@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_15814_10119885.1144596883544" References: X-Archive-Number: 200604/176 X-Sequence-Number: 18260 ------=_Part_15814_10119885.1144596883544 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 4/9/06, Chethana, Rao (IE10) wrote: > > > > > Hello! > > > > Kindly go through the following , > > > > > > I wanted to know whether, the command line arguments(function arguments) ------ $1 $2 $3 -- can be used as in the following , like, ---- > > > > > > CREATE TYPE TT AS(something,something,=85=85=85=85=85=85=85=85=85=85=85= =85=85=85=85=85=85=85=85=85=85=85etc=85=85=85=85=85=85); > > CREATE OR REPLACE FUNCTION f1(varchar,varchar,varchar,varchar) RETURNS =85=85=85=85=85=85=85..(something)=85=85=85=85. > the overall idea expressed is doable. following are comments 1. you have to put RETURNS setof TT (if you plan to return TT) since you used RETURN NEXT 2. you have to use SELECT INTO rec in the function where rec is rowtype T= T hope it helps ------- non technical comments ------------------------------------------------------ 3. its not a performance question , it shud have been marked more appropriately to pgsql-sql i think. 4. its not a good etiquette to address email to someone and mark Cc to a list. kind regds mallah. > > > BEGIN > > SELECT a1,a2,a3,a4,a5,a6 > > FROM (SELECT * FROM T1, T2=85=85WHERE =85=85=85=85etc=85 Flag =3D 0 = $1 $2 $3 $4) > > ORDER BY =85=85=85=85=85=85=85=85 > > =85=85=85=85=85=85=85=85=85=85. > > RETURN NEXT =85=85=85; > > END LOOP; > > RETURN; > > END; > > ' LANGUAGE 'plpgsql'; > > > > NOTE : The values for $1 $2 $3 $4 will be passed when the function i= s invoked(called) from the command prompt. > > > > I tried implementing the above, but this type of usage is not supported , how should use it? > > > > I am converting from (sprintf, "SELECT query stmts (which uses %s %s %s %s =85=85 ) to functions. > > > > > > Any help will be deeply appreciated. Thank you. > > > > > > Kind regards, > > Chethana. > > > > > > ------=_Part_15814_10119885.1144596883544 Content-Type: text/html; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline

On 4/9/06, Chethana, Rao (IE10) <Chethana.Rao@honeywell.com> wrote:
>
>&n= bsp;            = ;   
>  
>
> Hello! &nbs= p;
>
>    
>
> Kindly go through the following ,  
>
>= ;    
>
>    
> =
> I wanted to know whether, the command line arguments(function arguments) ------  $1 $2 $3   --  can be used  as in the following , like, ----  
>
&g= t;    
>
>    
>=
> CREATE TYPE TT AS(something,something,=85=85=85=85=85=85=85=85=85= =85=85=85=85=85=85=85=85=85=85=85=85=85etc=85=85=85=85=85=85);  <= br>>
> CREATE OR REPLACE FUNCTION f1(varchar,varchar,varchar,varc= har) RETURNS =85=85=85=85=85=85=85..(something)=85=85=85=85.  
>

the overall idea expressed is doable.
following are comments

1. you have to put RETURNS setof TT (if you plan to return TT) since you us= ed RETURN NEXT
2.  you have to use SELECT INTO rec  in the function where rec is= rowtype TT

hope it helps

------- non technical comments --------------------------------------------= ----------
3. its not a performance question , it shud have been marked more appropria= tely to pgsql-sql  i think.
4. its not a good etiquette to address email to someone and mark Cc to a li= st.

kind regds
mallah.

>    
>
> BEGIN  
>=
>  SELECT a1,a2,a3,a4,a5,a6  
>
>&= nbsp; FROM (SELECT * FROM T1, T2=85=85WHERE =85=85=85=85etc=85 &n= bsp; Flag =3D 0   $1 $2 $3 $4)  
>
> =  ORDER BY =85=85=85=85=85=85=85=85        &nb= sp;            =             &nb= sp;            =             &nb= sp;           
&g= t;
> =85=85=85=85=85=85=85=85=85=85.  
>
> RE= TURN NEXT =85=85=85;  
>
>   END LOOP;&nbs= p; 
>
>   RETURN;  
>
> = END;  
>
> ' LANGUAGE 'plpgsql';  
>
> &= nbsp;  
>
> NOTE :    The values for  $1 $2 $3 $4  will be passed when the function is invoked(called)  from the command prompt.  
> >    
>
> I  tried implementing the above, but  this type of usage is not supported , how should use it?    
>=
>    
>
>  I am converting  from (sprintf, "SELECT query stmts (which uses   %s %s %s %s  =85=85 )        to functions.  
>
>    
> >    
>
> Any help will be deeply appr= eciated.  Thank you.  
>
>  &nbs= p; 
>
>    
>
> Kind reg= ards,  
>
>       Chet= hana.  
>
>    
>
>   = ; 
>
>        &nb= sp; 

------=_Part_15814_10119885.1144596883544--