Re: Re: Argument variables for select

From: Keith Wong <keith(at)e-magine(dot)com(dot)au>
To: Andreas Tille <tillea(at)rki(dot)de>
Cc: PostgreSQL SQL <pgsql-sql(at)hub(dot)org>
Subject: Re: Re: Argument variables for select
Date: 2000-08-29 13:33:06
Message-ID: 4.3.2.7.0.20000829232708.00b18828@mail.e-magine.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi Andreas,

I've worked with MS SQL stored procedures before and they are quite
powerful. Its a shame postgres doesn't have the same
level of features as offered by MS SQL, but apart from this area it is
still a very good database. Perhaps in the coming
versions we will see more stored procedure features? I'm not sure what your
application is exactly but there are ways
to work around the features that are missing.

Good luck with convincing your boss :)

Keith.

At 02:28 PM 29/08/2000 +0200, Andreas Tille wrote:
>On Mon, 28 Aug 2000, Yury Don wrote:
>
> > > 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 )
> > >
> > AFAIK it's impossible with plpgsql, but it's possible in pltcl.
>
>It is really hard to believe that I'm in so very deep trouble with
>PostgreSQL. It seems to me that stored procedures are far from beeing
>as usefull as I learned them to know in MS SQL server. Once I try
>to follow one hint I'm standing in frot of the next even harder problem.
>
>
>web=# create function testfunc( )
>web-# returns int
>web-# As '
>web'# spi_exec "SELECT count(*) AS $num FROM testtable"
>web'#
>web'# return $num ;
>web'# End; '
>web-# language 'pltcl' ;
>ERROR: Unrecognized language specified in a CREATE FUNCTION:
>'pltcl'. Recognized languages are sql, C, internal and the created
>procedural languages.
>
>
>I have installed the pgtcl package of my Debian distribution, so I guess
>it should be available. Once more the question: Is it really necessary to
>use a further interpreter instead of sticking with SQL commands to use
>the original problem.
>
>I have to admit that my boss wonders why I'm switching from a working
>solution (MS SQL) to so much trouble :-(. I really hope to convince him
>to OpenSource but it's much harder than I expected.
>
>Kind regards
>
> Andreas.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message hlefebvre 2000-08-29 13:59:08 Re: Re: Argument variables for select
Previous Message Andreas Tille 2000-08-29 12:28:16 Re: Argument variables for select