function and passing the table name to be used with SQL stmnt

Поиск
Список
Период
Сортировка
От kamiseq
Тема function and passing the table name to be used with SQL stmnt
Дата
Msg-id 1193685486.126960.251720@57g2000hsv.googlegroups.com
обсуждение исходный текст
Ответы Re: function and passing the table name to be used with SQL stmnt
Список pgsql-general
ok so my probelm is I have a simple function like this
CREATE OR REPLACE FUNCTION bookid(_tabela varchar) RETURNS integer AS $
$
DECLARE
    _id integer := 0;
BEGIN
    SELECT INTO _id id FROM _tabela order by id desc limit 1;

    RETURN _id+1;
END;
$$ LANGUAGE plpgsql;

and the problem is i can run this function cos im passing string to
SQL statement and not the table object. hym what can I do about it to
have function that will give me next id number back;


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

Предыдущее
От: "Peckham, Martin"
Дата:
Сообщение: nonstandard use of
Следующее
От: rski
Дата:
Сообщение: plperl ubuntu problem