Subject | Best Practice re null |
---|---|
Author | homerjones1941 |
Post date | 2011-11-05T21:30:09Z |
In certain queries I wish nulls to be treated as empty strings. For example:
Select Field1 || ' ' || Field2 AS MyOutputValue;
In this example, I want the value for Field1 to be returned even if Field2 is null.
My first thought is to define a default of '' for the Domains that govern all such fields. At the moment, I can't think of a case where null values would ever be needed in those fields, but my crystal ball is not always accurate. So:
1. Is assigning a default of '' an acceptable practice?
2. Is there a better way to handle this, perhaps within the query SQL?
Select Field1 || ' ' || Field2 AS MyOutputValue;
In this example, I want the value for Field1 to be returned even if Field2 is null.
My first thought is to define a default of '' for the Domains that govern all such fields. At the moment, I can't think of a case where null values would ever be needed in those fields, but my crystal ball is not always accurate. So:
1. Is assigning a default of '' an acceptable practice?
2. Is there a better way to handle this, perhaps within the query SQL?