From: | "Yuri A(dot) Kabaenkov" <sec(at)artofit(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: interval |
Date: | 2001-12-03 17:09:53 |
Message-ID: | 1740527435.20011203200953@artofit.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello Thomas,
Monday, December 03, 2001, 8:01:45 PM, you wrote:
>> How can i get time interval only in minutes or in seconds ?
>> For example i have '1 month 15 days' and i need these time in
>> minutes.
TL> lockhart=# select extract(epoch from interval '1 month 15 days') / 60;
TL> ?column?
TL> ----------
TL> 64800
TL> (1 row)
Oh...thanks one more question.
I create these function:
CREATE FUNCTION sum_revenue() RETURNS real AS '
DECLARE
call RECORD;
BEGIN
tmpsum := 0;
FOR call IN SELECT
country,(date_part('epoch), starttime - endtime)::float AS seconds ,type from calls where sub_acc = 4 LOOP
RETURN call.minutes;
END LOOP;
end;
' LANGUAGE 'plpgsql';
And in call.minutes i've got '0';
Why ? How can i retrive call.minutes ?
these RETURN only for debug.
TL> - Thomas
------------
With respect,
Yuri A. Kabaenkov
hellman(at)artofit(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Carsten Gerhardt | 2001-12-03 17:17:11 | Re: When do I Vacuum ? |
Previous Message | Tom Lane | 2001-12-03 17:05:14 | Re: Should I use CAST? |