pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris Ryan <chris@greatbridge.com>
To: Andreas Tille <tillea@rki.de>
Cc: PostgreSQL General <pgsql-general@postgresql.org>
Subject: Re: Is this the wrong list?
Date: Wed, 16 Aug 2000 09:54:40 -0400
Message-ID: <399A9D20.2B63A267@greatbridge.com> (raw)
References: <Pine.LNX.4.21.0008161533120.654-100000@wr-linux02.rki.de>

You'd probably be better off in pgsql-sql@postgresql.org. Also look
under the programmers documention for the interfaces (Specific interface
questions should probably go to pgsql-interfaces@postgresql.org) There
are ways to functions in Sql, PL/PgSQL, TCL etc. etc. It all depends on
what you need to do.

Here is a quick example on writing an sql procedure with parameters:

(create table and add some data)

CREATE FUNCTION get_user_age(int4) RETURNS int4
    AS 'select user_age from user_tbl where user_id = $1' LANGUAGE
'sql';

select get_user_age(2);
 get_user_age 
--------------
           13
(1 row)

Chris Ryan

Andreas Tille wrote:
> 
> On Mon, 14 Aug 2000, I wrote under the subject "Any SQL-functions examples
> available":
> 
> > I tried to write my first SQL-functions with the intention to
> > port some stored procedures from MS SQL server.  It would make my
> > task much simpler if someone could point me to some simple
> > examples which demonstate the use of function parameters in
> > SELECT/INSERT statements and how to get the results transformed
> > into reasonable return types, for instance if SELECT was successful
> > return true else false, etc.
> Is there any other list where I could expect answers to those simple
> questions.  I could not imagine that nobody has ever written some
> simple tests with SQL functions.  Perhaps this problem is to simple
> here.
> 
> Or may be I have the wrong philosophy and those functions are not
> ment to be used in PostgreSQL?
> 
> Kind regards
> 
>         Andreas.



view thread (3+ messages)  latest in thread

Message-ID: <399A9D20.2B63A267@greatbridge.com>
Permalink:  ../399A9D20.2B63A267@greatbridge.com/
Also on:    postgresql.org/message-id/399A9D20.2B63A267@greatbridge.com

 · 

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: chris@greatbridge.com, tillea@rki.de, pgsql-general@postgresql.org
  Subject: Re: Is this the wrong list?
  In-Reply-To: <399A9D20.2B63A267@greatbridge.com>
  References: <Pine.LNX.4.21.0008161533120.654-100000@wr-linux02.rki.de> <399A9D20.2B63A267@greatbridge.com>

* 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