Avatar of AmmarDJ
AmmarDJ asked on

Data extraction


I am extracting some data from the database.

Theses are four fields i.e. value field1,value field2,value field3,value field4 and the fifth field just carries the unit.

I want that if the value fields are blank it should not report anything. In this case it reports a unit.

And if the value field has a value it should report the value as well as the unit.

How to do it?

  value field1||'~'||unit field ||','||
  value field2  ||'~'||unit field ||','||
   value field3  ||'~'||unit field ||','||
    value field4 ||'~'||unit field ||','||
    unit field||','||
Oracle DatabaseDB Reporting Tools

Avatar of undefined
Last Comment

8/22/2022 - Mon

if you want to exclude rows where values 1 to 4 all are empty (null) add a where clause

value field 1 is not null AND
value field 2 is not null AND
value field 3 is not null AND
value field 4 is not null

Rindbaek can i use a where clause in a script like the one attached.

you already have one...

WHERE system = '77';

WHERE system = '77' AND
value field 1 is not null AND
value field 2 is not null AND
value field 3 is not null AND
value field 4 is not null ;
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question


Thanks for the feedback.

regarding the nvl function, sounds a a good solution.

But i guess it will report a "null" if there is a null value. What if i just want to report a blank and not "null"


Change the null at the end of the nvl2 statement to anything you want.  Since you are doing string concatenation, if it is null, there is nothing to concatenate.