pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Yury Don <yura@vpcit.ru>
To: pgsql-sql@hub.org
Subject: Re: Argument variables for select
Date: Mon, 28 Aug 2000 15:21:32 +0600
Message-ID: <39AA2F1C.2CCE9860@vpcit.ru> (raw)
References: <Pine.LNX.4.21.0008280957530.30760-100000@wr-linux02.rki.de>

Andreas Tille wrote:
> 
> Hello,
> 
> I want to use the following construct in a stored function:
> 
> Create Function VarSelect ( varchar, varchar )
>    returns int
>    As '
>      Declare num int ;
> 
>      Begin
>        Select Into num Count(*) From $1 Where $2 ;
>        return num;
>      End ;
>    ' language 'plpgsql' ;
> 
> Could someone please explain who to type the exact syntax so that
> I can ship the table to select from as $1 and the condition to select
> what as $2?  Or do I have to concatenate a string with the whole
> select statement and how to call this string?  In MS SQL server this
> could be done with
>    Exec ( query )
> 
> Kind regards
> 
>           Andreas.

AFAIK it's impossible with plpgsql, but it's possible in pltcl.

-- 
Sincerely yours,
Yury



view thread (7+ messages)  latest in thread

Message-ID: <39AA2F1C.2CCE9860@vpcit.ru>
Permalink:  ../39AA2F1C.2CCE9860@vpcit.ru/
Also on:    postgresql.org/message-id/39AA2F1C.2CCE9860@vpcit.ru

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: yura@vpcit.ru, pgsql-sql@hub.org
  Subject: Re: Argument variables for select
  In-Reply-To: <39AA2F1C.2CCE9860@vpcit.ru>
  References: <Pine.LNX.4.21.0008280957530.30760-100000@wr-linux02.rki.de> <39AA2F1C.2CCE9860@vpcit.ru>

* 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