I have a SQL query in which I am passing sysdate to the query problem is that when there is no matching date in table with sysdate then it don’t shows the zero even if there is nvl applied
here is my query
select * from molasses
where trunc(trn_dte) = trunc(sysdate)
But it show data only when current date is present in table but I want to show zero if no data found in table.please help me to do this in oracle 10 g. Because some times the situation is like above and I have to display zero when no data found
This is weird and I wouldn’t use it, it’s more of a hack:
One only wonders what the application/user will understand when there is exactly one row in the table and all the values are zero.
I think this would work, too:
and show Nulls instead of (the wanted) 0s. Using the
COALESCE()function could easily fix that, as well.