Skip to main content
roshanbi
Gold ⭐️
July 13, 2021
Solved

concat string and null

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

 

roshanbi
roshanbiAnswer
Gold ⭐️
July 13, 2021

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

 

2 replies

roshanbi
roshanbiAuthorAnswer
Gold ⭐️
July 13, 2021

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

 

Translate
cjervis
Community Manager
Community Manager
July 14, 2021

@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.pngmark as solution button

 

Translate
Keep the questions coming