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: time issue

Re: time issue

From: Igor Neyman <ineyman_at_perceptron.com>
Date: Fri, 25 Jan 2002 06:05:19 -0800
Message-ID: <F001.003FB09A.20020125053019@fatcity.com>

Ooops..

Jared,
You are right.
I didn't notice the order of the dates in 'between' condition. That's why I prefer to use:

    where Time_Stamp > ...
      and Time_Stamp < ...
in this case don't have to bother about the order.

Still, 'group by' attracted my attention, because even with correct order of the dates in 'between' condition, the result will be wrong, like in:

SQLWKS> create table b1(c1 int, c2 varchar2(10)); Statement processed.
SQLWKS> insert into b1 values(1, 'aa');
1 row processed.
SQLWKS> insert into b1 values(2, 'ab');
1 row processed.
SQLWKS> insert into b1 values(3, 'ac');
1 row processed.
SQLWKS> insert into b1 values(4, 'ad');
1 row processed.
SQLWKS> insert into b1 values(5, 'ae');
1 row processed.
SQLWKS> insert into b1 values(6, 'af');
1 row processed.
SQLWKS> commit;
Statement processed.

SQLWKS> select count(c2) from b1
     2> where c1 between 2 and 5
     3> group by c1;

COUNT(C2)
         1
         1
         1
         1

4 rows selected.

While:

SQLWKS> select count(c2) from b1

     2> where c1 between 2 and 5;
COUNT(C2)


         4
1 row selected.

gives correct answer.

Igor Neyman, OCP DBA
ineyman_at_perceptron.com

> Igor,
>
> That SQL will always return zero rows.
>
> Jared
>
>
>
>
>
> "Igor Neyman" <ineyman_at_perceptron.com>
> Sent by: root_at_fatcity.com
> 01/24/02 02:45 PM
> Please respond to ORACLE-L
>
>
> To: Multiple recipients of list ORACLE-L
<ORACLE-L_at_fatcity.com>
> cc:
> Subject: Re: time issue
>
>
> Just
>
> Select count(*) users
> from cp_license_use
> where Time_Stamp between SYSDATE and (sysdate - 30/1440);
>
> should do it (no 'group by').
>
> Igor Neyman, OCP DBA
> ineyman_at_perceptron.com
>
>
> ----- Original Message -----
> To: "Multiple recipients of list ORACLE-L" <ORACLE-L_at_fatcity.com>
> Sent: Thursday, January 24, 2002 4:35 PM
>
>
> >
> > I am using the following Statement: I am getting no records returned.
> Any
> > idea what is wrong?
> > thanks again
> > Lance
> >
> > Select count(User_name) users
> > from cp_license_use
> > where Time_Stamp between SYSDATE and (sysdate - 30/1440)
> > group by Time_stamp
> >
> > To grab data from the following table: SYSDATE = 1/24/2002 9:33:16 PM
> > User_Name Time_stamp
> > dsilver 1/24/2002 9:31:33 PM
> > cnelson 1/24/2002 9:31:33 PM
> > eho 1/24/2002 9:31:33 PM
> > mreza 1/24/2002 9:31:33 PM
> > kjuneja 1/24/2002 9:31:33 PM
> > sislam 1/24/2002 9:31:33 PM
> > dkotha 1/24/2002 9:31:33 PM
> > mbalthrop 1/24/2002 9:31:33 PM
> > tchung 1/24/2002 9:31:33 PM
> > cnifong 1/24/2002 9:31:33 PM
> > sluc 1/24/2002 9:31:33 PM
> > dtrevino 1/24/2002 9:31:33 PM
> > ddobson 1/24/2002 9:31:33 PM
> > echinwub 1/24/2002 9:31:33 PM
> > dmoses 1/24/2002 9:31:33 PM
> > gpratt 1/24/2002 9:31:33 PM
> > syahmed 1/24/2002 9:31:33 PM
> > mreza 1/24/2002 9:31:33 PM
> >
> > --
>
>
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author:
> INET: Jared.Still_at_radisys.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: Igor Neyman
  INET: ineyman_at_perceptron.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 Fri Jan 25 2002 - 08:05:19 CST

Original text of this message

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