Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: An SQL question , not easy ;-)

RE: An SQL question , not easy ;-)

From: Lord, David - C&S <David.Lord_at_hayscsg.com>
Date: Wed, 15 Aug 2001 05:28:19 -0700
Message-ID: <F001.0036AFDA.20010815051113@fatcity.com>

How about: -

declare

        l_count pls_integer := 0;
begin

        for rec in (
                select call_start time, 1 incr from table
                union all
                select call_end time, -1 incr from table
                order by 1
        ) loop
                l_count := l_count + rec.incr;
                dbms_output.put_line( to_char(rec.time) || ' - ' || l_count
)
        end loop;

end;

Haven't tried it, but it looks feasible.

HTH
David Lord

> -----Original Message-----
> From: Andrey Bronfin [mailto:andreyb_at_elrontelesoft.com]
> Sent: 15 August 2001 11:21
> To: Multiple recipients of list ORACLE-L
> Subject: An SQL question , not easy ;-)
>
>
> Dear gurus !
> I have a table of phone calls , 2 fields : CALL_START DATE
> , CALL_END
> DATE .
> I need an SQL statement or a PL/SQL block to calculate the
> maximum number of
> SIMULTANIOUS phone conversations.
> Please help !!!
> Thanks a lot in advance !
> Andrey.
>
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Andrey Bronfin
> INET: andreyb_at_elrontelesoft.com
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
>

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Lord, David - C&S
  INET: David.Lord_at_hayscsg.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Wed Aug 15 2001 - 07:28:19 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US