Plpgsql function and variable substitute

Поиск
Список
Период
Сортировка
От Jiří Němec
Тема Plpgsql function and variable substitute
Дата
Msg-id 1128273205.20070516151117@menea.cz
обсуждение исходный текст
Ответы Re: Plpgsql function and variable substitute  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Re: Plpgsql function and variable substitute  (Alban Hertroys <alban@magproductions.nl>)
Список pgsql-general
Hello,

I have searched the Internet for an answer but nothing works for me.

There is a plpgsql function which is used in a trigger. I need to
substitute a value "7" for "lifetime" (integer) SELECTed in a previous
query.

DECLARE
  lifetime integer;

BEGIN

    SELECT foo INTO lifetime FROM tblname;

    UPDATE ....
    SET expiretime = expiretime + interval '7 days'
    WHERE .....

  RETURN NEW;

END;

This doesn't work for me:

SET expiretime = expiretime + interval 'lifetime days'
SET expiretime = expiretime + interval || lifetime || 'days'

Thank you for your help or for a some useful link.

--
Jiri Nemec
http://www.meneashop.cz/


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

Предыдущее
От: marcelo Cortez
Дата:
Сообщение: Re: dns less connection
Следующее
От: "Ian Harding"
Дата:
Сообщение: Re: Postgres Printed Manuals