i want to do search depend on date , when i use this statement it gives me empty result
Select * from apps.xx_fa_track where TO_CHAR(trx_date, 'mm/dd/yyyy') = '5/25/2014'
Select to_char(sysdate, 'MM/DD/YYYY') FROM apps.xx_fa_track
Can someone please help?
You can use the FM
format modifier to stop the string versrion of the date having leading zeros:
where TO_CHAR(trx_date, 'FMmm/dd/yyyy') = '5/25/2014'
SQL Fiddle of the difference .
But it's generally better to convert your fixed value to the column's data type:
where trx_date = TO_DATE('5/25/2014', 'mm/dd/yyyy')
If your trx_date
includes a time portion you can use a range to cover the whole day, but not sure that's needed here.
I guess you should format month in your date with two digits " 05 /25/2014". Like here:
Select * from apps.xx_fa_track where TO_CHAR(trx_date, 'mm/dd/yyyy') = '05/25/2014'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.