How do I specify intervals in functions?

Поиск
Список
Период
Сортировка
От Rob Richardson
Тема How do I specify intervals in functions?
Дата
Msg-id 04A6DB42D2BA534FAC77B90562A6A03D9A2261@server.rad-con.local
обсуждение исходный текст
Ответы Re: How do I specify intervals in functions?  (Michael Glaesemann <michael.glaesemann@myyearbook.com>)
Re: How do I specify intervals in functions?  (Volkan YAZICI <yazicivo@ttmail.com>)
Re: How do I specify intervals in functions?  ("Rob Richardson" <Rob.Richardson@rad-con.com>)
Re: How do I specify intervals in functions?  ("Rob Richardson" <Rob.Richardson@rad-con.com>)
Re: How do I specify intervals in functions?  ("Rob Richardson" <Rob.Richardson@rad-con.com>)
Список pgsql-general
Greetings!
 
In the help file under date and time functions, I see that intervals can be specified as "interval '3 hours' ".  In a PgAdmin SQL window, I can enter "select interval '3 hours' ", and it will return me "03:00:00", as expected.  I can also enter "select '3 hours'::interval", and get the same result.  Yet neither syntax works inside a function. 
 
declare
     ThreeHours interval;
begin
     ThreeHours = interval '3 hours';  -- throws a syntax error
     ThreeHours = '3 hours'::interval; -- also throws a syntax error
end;
 
So how do I specify an interval in a function?
 
Specifically, I'm trying to do something like the following:
 
    if NewRevisionTime < PredictedEndTime - '08:00:00'::interval then
 
Since both of the shown forms give syntax errors, how do I subtract eight hours from a time???
 
Thank you very much.
 
RobR, who posted this on the novice list but got no answers.
 

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

Предыдущее
От: "Reko Turja"
Дата:
Сообщение: Re: Shared object "libpq.so.3" not found
Следующее
От: Michael Glaesemann
Дата:
Сообщение: Re: How do I specify intervals in functions?