Re: interval - Mailing list pgsql-general

From Yuri A. Kabaenkov
Subject Re: interval
Date
Msg-id 1740527435.20011203200953@artofit.com
Whole thread Raw
In response to Re: interval  (Thomas Lockhart <lockhart@fourpalms.org>)
List 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@artofit.com


pgsql-general by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: interval
Next
From: bombadil@wanadoo.es
Date:
Subject: Re: Problem (bug?) with like