Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2014
    Posts
    1

    Unanswered: How to select today record from db oracle?

    Hai, i'am still new using oracle..

    Can anyone help held how to get today record from db?
    This id my query..

    SELECT * FROM A
    WHERE AADATE > To_Char(Trunc(SYSDATE-1),'YYYYMMDD')

    This query works but is show all the data..

    In sql i use this and it result same what i want:

    SELECT *
    FROM A
    WHERE AADATE > CURRENT_TIMESTAMP - 1

    But how in oracle?it's my query false??

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    If AADATE doesn't contain time:
    Code:
    select * 
    from a
    where aadate = trunc(sysdate)
    If AADATE contains time:
    Code:
    ... where trunc(aadate) = trunc(sysdate)
    If the latter, possible index on AADATE won't be used (but you might create a function based index if necessary), or develop different approach.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •