February 21st, 2004, 11:21 PM
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'.
The above sql returns no record. But i have records in table A.
select * from A where trunc(ac_datetime) < to_date('21-02-2004 11:30:00', 'dd-mm-yyyy hh24:mi:ss');
What is the sql command?I'm using the oracle db.
Last edited by weebeng; February 21st, 2004 at 11:45 PM.
February 22nd, 2004, 10:29 PM
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
February 23rd, 2004, 02:58 AM
I've get the result by removing the trunc(), since trunc() will truncates time part.
Anyway, thank you very much