stockton Posted May 15, 2009 Share Posted May 15, 2009 I need to build an Oracle sql string where I need to check that if a datetime column is not blank its value must be greater than current_date and I am failing. SELECT ColumnData FROM MyTable WHERE STARTDATE > current_date AND (ENDDATE !="" and ENDATE > current_date) Please tell me how I should do this. Quote Link to comment https://forums.phpfreaks.com/topic/158251-solved-oracle-sql-string-for-blank-or-populated-date/ Share on other sites More sharing options...
stockton Posted May 16, 2009 Author Share Posted May 16, 2009 SELECT ColumnData FROM MyTable WHERE STARTDATE >= TRUNC(current_date) AND NVL(ENDATE, current_date+1) >= TRUNC(current_date); seems to work for me. Quote Link to comment https://forums.phpfreaks.com/topic/158251-solved-oracle-sql-string-for-blank-or-populated-date/#findComment-835172 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.