Oracle Dual table trick
Submitted by radu on March 28, 2010 - 2:05pm
The other day I had to create a simple SELECT query. The query should return a single column result set or a default value if there was no data in the table. I know this would be a no brainer for somebody proficient in SQL, but I still find the solution neat enough to post it here.
SELECT NVL((SELECT COLUMN FROM TABLE WHERE KEY=VALUE), default_value) FROM DUAL;

Add new comment