Click here to Skip to main content
15,894,896 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
select dp.* from gb.dpacnt dp where DP.OPENEDDATE between TO_DATE ('2003/08/13', 'YYYY/MM/DD')
                             AND TO_DATE (trunc(sysdate), 'YYYY/MM/DD' )





This returned no value
Why?
Posted

1 solution

SYSDATE[^] function returns the current system date and time on your local database. If you want to extract the date portion only (and reject the time part), you should use the TO_CHAR()[^] function. For example:
SQL
SELECT dp.*
FROM gb.dpacnt dp
WHERE TO_CHAR(DP.OPENEDDATE,'yyyy/mm/dd') BETWEEN TO_DATE ('2003/08/13', 'yyyy/mm/dd') AND TO_CHAR(SYSDATE, 'yyyy/mm/dd')
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900