Is there a way to define a default value when the sql on the select field found no record or has errors?
Re: Define default when no record found on select field
If you program correct, it should give no errors.
In what situation can such a select query return no records? What kind of field is this?
Keep in mind that when you query existing records, and the value that is stored in the database is not (anymore) available in the select on the field, the application will display the first value found instead. Try to avoid this situation.
If you are aware of the above and still want a workaround, here it is:
select colval
from tablename
where id = 99
union
select 'default value'
from dual
where not exists
(
select colval
from tablename
where id = 99
)
When values are found, the second query after the union does noet return a record.
When no values found, the second query returns “default value”
Re: Define default when no record found on select field
Thanks freezer its helping me out here.
Sorry for the late reply.