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!

Can not use NVL with group by clause?

AngshumanSep 22 2013 — edited Sep 22 2013

Hi All, I am using following sql query to fetch some records. select       nvl('RP5_dsc_dlk_MED_DEL_SBH_20130919_5799.out.bc','RP5_dsc_dlk_MED_DEL_SBH_20130919_5799.out.bc')||'|'||       nvl(tm_cdr_file_name,'NA')||'|'||       nvl(min(obj_id0),'0')||'|'||       nvl(max(obj_id0),'0')||'|'||       nvl(count(obj_id0),'0')||'|'||       nvl(trim(to_char(sum(VOLUME_RECEIVED)/100,'9999999999999990.99')),'0') from       EVENT_DLAY_SESS_TLCS_T where       obj_id0 between 1433833603724199101 and 1433833603724199109 group by       nvl(tm_cdr_file_name,'NA') The above query is perfect and returns data. In this case the returned data is as below:   RP5_dsc_dlk_MED_DEL_SBH_20130919_5799.out.bc|ICP_dsc_dlk_MED_DEL_SBH_20130919_5799.edr|1433833603724199101|1433833603724199109|9|2.00 However, when there is no matching obj_id0. My expected result will be as below:   RP5_dsc_dlk_MED_DEL_SBH_20130919_5799.out.bc|NA|0|0|0|0 I tried NVL and decode but it did not work. Any help on this is highly appreciated. Thanks Angsuman

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 20 2013
Added on Sep 22 2013
2 comments
3,719 views