You can utilize the use of NVL() function to replace the column values that are nulls to some other character that you want
example
NVL(account_Type,'Not Available') or something like that
Main Topics
Browse All TopicsI am looking for a way to have my column header lengths always be the full name of the column and at the same time have my data always show only as long as it actually is and not aligning to the header lengths in case the data is shorter than the header. This is causing me a serious headache I really hope you can help.
I want it like this
account_no;account_status;
12345645666666;CO;REGULAR;
as opposed to this
account_no; account_status;account_typ
12345645666666;CO ;REGULAR ;01-01-2008 01:01:01
In sqlplus i am doing the following:
set linesize 10000;
set pages 0 emb on newp none;
set feedback off;
set echo off;
set trimspool on;
set colsep ¤
set termout off;
set underline off;
column dcol new_value mydate noprint
select to_char(sysdate,'YYYYMMDD'
select account_no,
account_status,
account_type,
to_char(run_date,'dd-mm-yy
from tmp_table;
spool MYFILE_&mydate
/
spool off;
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.
This seems to be working very nicely indeed. I have one issue though. I have many more columns in my table than the ones I posted originally and it seems the first part of the union gets too long to show all the column names. My linesize is set to 10000 which should be plenty :-)
Also in the spool file there is a ' in the first position of the first line?!
insert any column name you want seperated by ; in the first query and it will display it for you , the whole solution idea depends on concatenating your data and separating values with a single ; that way you get your data formated. Try it and let me know if you have any problem still .
select 1 as Col_Id,'Account_No;Account
from dual
UNION
select 2 as col_id,
account_no||';'||
account_status||';'||
account_type||';'||
to_char(run_date,'dd-mm-yy
Col1||';'||
Col2||';'||
Col3||';'||
.....
||chr(13) as Col_Data
from temp_table
Business Accounts
Answer for Membership
by: Dr_BillyPosted on 2008-06-03 at 11:31:10ID: 21703065
What you need to do is the following
Select allOpen in new window