sql - How to assign default value to empty column -
i working on report builder 6i.
i have 2 tables
1- company_info
2- address_info
comp_addr_code foreign key in company_info table primary key in address_info table.now retrieving data address_table base on comp_address_code.but in cases first 3 columns empty in address_info table.
i want these columns 'x' should displayed.what changes should make in sql statement.my sql statement is:
select comp_code, comp_name, comp_addr_code, company_info, address_info comp_code=:p_comp_code , comp_addr_code=addr_code
use coalesce
, picks first non-null value. i.e. if column value not null, return column value, else return specified default value:
select coalesce(comp_code,'x'), coalesce(comp_name,'x'), etc
Comments
Post a Comment