Question about SQL FUnction

Поиск
Список
Период
Сортировка
От Martin Möderndorfer
Тема Question about SQL FUnction
Дата
Msg-id 36CB1268.ED358843@linux.stuco.uni-klu.ac.at
обсуждение исходный текст
Ответы Re: [SQL] Question about SQL FUnction
Список pgsql-sql
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

В списке pgsql-sql по дате отправления:

Предыдущее
От: Terry Mackintosh
Дата:
Сообщение: Re: [ADMIN] Creating Textfiles out of tables
Следующее
От: Atika
Дата:
Сообщение: ...