Support Questions

Find answers, ask questions, and share your expertise

concat string and null

avatar
Contributor

Hello Team,

 

can you please advise how to replace nulls by a default value?

 

select concat(cast(glb.budget_version_id as string)," ", cast(glc.segment1 as string)) as balid
from oracle_financial.gl_balances glb,
oracle_financial.gl_code_combinations glc,
oracle_financial.gl_ledgers glg ;

 

roshanbi_0-1626154669062.png

If I add a null to a value, null will be returned.

 

I tried NVL it is not working.

 

Thanks,

 

Roshan

 

1 ACCEPTED SOLUTION

avatar
Contributor

On Oracle below works

select
concat(nvl(cast(glb.budget_version_id as varchar2(10)),0), cast(glc.segment1 as varchar2(10))) as balid
from gl.gl_balances glb,
gl.gl_code_combinations glc,
gl.gl_ledgers glg ;

 

roshanbi_0-1626160134970.png

Impala

roshanbi_1-1626160160761.png

 

View solution in original post

2 REPLIES 2

avatar
Contributor

On Oracle below works

select
concat(nvl(cast(glb.budget_version_id as varchar2(10)),0), cast(glc.segment1 as varchar2(10))) as balid
from gl.gl_balances glb,
gl.gl_code_combinations glc,
gl.gl_ledgers glg ;

 

roshanbi_0-1626160134970.png

Impala

roshanbi_1-1626160160761.png

 

avatar
Community Manager

@roshanbi Is your issue resolved?

 

If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future. 

Screen Shot 2019-08-06 at 1.54.47 PM.png

 


Cy Jervis, Manager, Community Program
Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.