From: Martin Möderndorfer <mmoedern@linux.stuco.uni-klu.ac.at>
To: pgsql-sql@postgresql.org
Subject: Question about SQL FUnction
Date: Wed, 17 Feb 1999 20:03:04 +0100
Message-ID: <36CB1268.ED358843@linux.stuco.uni-klu.ac.at> (raw)
hi,
i have some tables:
create table person (nr int4, name varchar(50));
create table book(nr int4, title varchar(50), persnr int4);
(persnr is the foreign key -> person.nr)
now i have some
CREATE FUNCTION get_new_nr(**TABLE**,**FIELDS**) RETURNS int4;
AS 'SELECT MAX($2) FROM $1 +1;'
LANGUAGE 'sql';
but **table** and **fields** needs some datatype. this function should
return the max of a set of all numbers in person (+1) and return this.
is it possible (and how ;-) to write such a very _flexible_ function??
MArtin
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: mmoedern@linux.stuco.uni-klu.ac.at
Subject: Re: Question about SQL FUnction
In-Reply-To: <36CB1268.ED358843@linux.stuco.uni-klu.ac.at>
References: <36CB1268.ED358843@linux.stuco.uni-klu.ac.at>
* 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