using variable in nextval

Поиск
Список
Период
Сортировка
От George Wadsworth
Тема using variable in nextval
Дата
Msg-id 374DE6DC.E8D30DD@agritope.com
обсуждение исходный текст
Список pgsql-sql
Hi!
I'm trying to use a variable as the sequence name in a nextval:
using pgsql 6.4.2, PL/pgSQL called from a trigger

-- site is a char() used to describe the location
-- generation is an int used for generations of plants
-- each site/generation combo has it's own sequence
site := new.site;
gen := new.generation;
sequencename := site || gen;
newSerial := nextval(sequencename);

I get ERROR: Only constant sequence names are acceptable for function
'nextval'

I've tried all sorts of quote, double quotes, etc and this is the
closest I've got.
Does anyone know of a workaround? There are 12 different combinations
and I don't really want to make a big, nasty, nested if...
thanks in advance.

-George Wadsworth


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

Предыдущее
От: "Mark Wright"
Дата:
Сообщение: How do I implement FIFO?
Следующее
От: "Andrei de Oliveira Mosman"
Дата:
Сообщение: