#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    76
    Rep Power
    12

    retrieve records according date time


    hi..i got question here.Hope that somebody can help me...
    Table A has field called ac_datetime(date data type). It stores the transactions datetime values in that field.
    I'd like to retrieve the records that is before '21-02-2004 11:30:00'.
    Code:
    select * from A where trunc(ac_datetime) < to_date('21-02-2004 11:30:00', 'dd-mm-yyyy hh24:mi:ss');
    The above sql returns no record. But i have records in table A.
    What is the sql command?I'm using the oracle db.
    Thank you!
    Last edited by weebeng; February 21st, 2004 at 10:45 PM.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    68
    Rep Power
    11
    The SQL code looks just fine. Are you sure the ac_datetime column holds non-null values? If so, can you please give us the output of:
    select ac_datetime from A
    where rownum<10;

    Regards,
    Dan
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    76
    Rep Power
    12
    I've get the result by removing the trunc(), since trunc() will truncates time part.
    Anyway, thank you very much

IMN logo majestic logo threadwatch logo seochat tools logo