In trying to get an sql stmt to return a default value, I read in the docs..
"The COALESCE function returns the first of its arguments that is not null. Null is returned only if all arguments are
null.It is
often used to substitute a default value for null values when data is retrieved for display, for example:
SELECT COALESCE(description, short_description, '(none)') ..."
But I seem to be missing something:
development=# create table t1 ( anum integer );
CREATE TABLE
development=# insert into t1 values ( 2 ), (3);
INSERT 0 2
development=# select * from t1;
anum
------
2
3
development=# select coalesce(anum,100) from t1 where anum = 4;
coalesce
----------
(0 rows)
Do I have to resort to PLPGSQL for this?
thanks for any info,
-ds
oh.. running 9.1