i will try this and let you know--thanks
Main Topics
Browse All TopicsI am creating an extract in SQL of some Oracle database columns. However, when some of the columns are blank, they do not SELECT. I would like to know how to SELECT a given column and insure that it will SELECT it even if it is blank or null.
Thank you
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
if you have columns with null values and you want to select them
them you have to do as shown below :
select col1, col2
from table1
where col3 is null; -- this will get all records from table1 where col3 is null.
select col1, col2
from table1
where col3 is not null; -- this will get all records from table1 where col3 is not null.
if you want to treat a null value as a different value in the queries, then we have to use
something like as shown below :
select col1, col2
from table1
where nvl(col1,9999) >= 100 ; -- i assume col1 is of number datatype
select col1, col2
from table1
where nvl(col2,'Other Dept') in ('Marketing','Other Dept') ; -- i assume col2 is of varchar2 datatype
We can even use decode, nvl2, coalesce.. to handle null values.
Thanks
Thank you for your many replies. I am posting my query. Notice that it is not a standard query--this one creates a fixed length text file.
I am interested in pulling all columns in the query, whether null or not. I do not know what columns may be null or not, so I need to check for that, and pull values if they are there, or space fill if it is null.
Please let me know how to accomplish this.
Thanks,
mark
Substring is not needed and hard coded values need not be padded.
SELECT 'D'
||RPAD(NVL(IDNT.SSN,' '),9)
||' '
||RPAD(NVL(LAST_NAME,' '),30)
||RPAD(NVL(ADDR.ADDR_LINE1
||RPAD(NVL(ADDR.ADDR_LINE2
||RPAD(NVL(ADDR.CITY,' '),20)
||RPAD(NVL(ADDR.ST_CD,' '),2)
||RPAD(NVL(ADDR.ZIP_CD,' '),9)
||'386004868'
||RPAD(' ',146)
||RPAD(NVL(CASE.DSCR,' '),16)
||'C'
||'16 '
||'48043 '
||'0'
||RPAD(NVL('ARPTY.AMT_OUTS
||'20080307'
||RPAD(' ',35)
...
* Note - If ARPTY.AMT_OUTSTANDING is of number datatype,
it needs to be first converted to character and probably
right justified. -
...
||LPAD(NVL(TO_CHAR(ARPTY.A
...
Business Accounts
Answer for Membership
by: pollock_dPosted on 2008-03-07 at 12:04:37ID: 21073733
try something like...
SELECT NVL(column1,''), NVL(column2,'')....etc
this will replace the NULL in the column with an empty string...\
it might work...havent tried it..