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

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL Date Format

Re: SQL Date Format

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Fri, 12 Feb 1999 20:49:26 GMT
Message-ID: <36c89376.16105588@192.86.155.100>


A copy of this was sent to bcrowell_at_sbmct.com (if that email address didn't require changing) On Fri, 12 Feb 1999 19:53:30 GMT, you wrote:

>I am trying to retreive data from my oracle database , based on a time. For
>example the following code will retreive the data if it is 11:00 or later.
>What i am trying to do is if i have some data that i know happend at 11:13am
>and i did NOT want my seql to pick it up , How would i format this ??
>
>Thanks for the help
>Bruce
>
>
>
>
>CONNECT INTERNAL/password_at_orapcbk;
>
>Select queapplhist.returncd, queapplhist.applnbr, queapplhist.checkpoint,
>queapplhist.startdatetime
> from queapplhist
> where queapplhist.returncd <> '0'
>
> and queapplhist.startdatetime > (to_date(sysdate)+11/24);
>
>

because to_date(sysdate) = sysdate. you want trunc(sysdate)

Consider:

SQL> alter session set nls_date_format = 'dd-mon-yyyy hh24:mi:ss'; Session altered.

SQL> select sysdate from dual;

SYSDATE



12-feb-1999 15:45:10

SQL> select to_date(sysdate)+11/24 from dual;

TO_DATE(SYSDATE)+11/



13-feb-1999 02:45:01

see -- thats 11 hours after right now

SQL> select trunc(sysdate)+11/24 from dual;

TRUNC(SYSDATE)+11/24



12-feb-1999 11:00:00

and thats 11 oclock today...

>
>
>EXIT;
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA

--
http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Fri Feb 12 1999 - 14:49:26 CST

Original text of this message

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