Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

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

 

Keep the questions coming