Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Default Column value in case of null

876673Oct 18 2011 — edited Oct 18 2011
Hi friends,

I am new to dimensional query and need help to set the default value for columns. The query is mentioned below. I need to include the default values when the data for the column is null. How to implement this?

Query:

SELECT distinct s_id,SName, ENV_TYPE, h_id
FROM (
select s_id,s_code,s_value from table
where s_id = 6070
)
MODEL
IGNORE NAV
PARTITION BY
(s_id)
DIMENSION BY
(s_code)
MEASURES
(s_value,CAST( '' AS VARCHAR2(256) ) AS SName, CAST( '' AS VARCHAR2(256) ) AS ENV_TYPE, 0 AS h_id )

RULES UPDATE
(

SName[ANY] = service_value['SName'],
ENV_TYPE[ANY] = s_value['ENV_TYPE'],
h_id[ANY] = s_value['h_id']


Output:

S_id SName ENV_TYPE h_id
6070 null null null
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 15 2011
Added on Oct 18 2011
3 comments
758 views