Solved

Formatting Report in Oracle SQL*Plus

Posted on 2007-12-02
4
933 Views
Last Modified: 2013-12-18
Hello Experts -
How can I do some simple formatting for a report in Oracle outside of just columns?
I'm looking to create a report such as:

                                     TITLE
Attribute1:  Data                                Attribute2:  Data
Attribute3:  Data                                Attribute4:  Data

Attribute 5                                         Attribute6
Data                                                  Data

The Attributes are headings.
Thanks for any help you can provide.
chezbrgrs
0
Comment
Question by:chezbrgrs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 13

Expert Comment

by:sonicefu
ID: 20393721
Are you using oracle reports ?
0
 

Author Comment

by:chezbrgrs
ID: 20393878
No.  I actually just figured it out...
I put it in the title like:
TTITLE CENTER 'Title' SKIP 3 -
 SKIP 2 LEFT 'Attribute1: ' att1_var -
 RIGHT 'Attribute2: ' att2_var SKIP 1 -
 'Attribute3: ' att3_var -
 RIGHT 'Attribute4: ' att4_var SKIP 2
0
 
LVL 27

Accepted Solution

by:
sujith80 earned 500 total points
ID: 20393926
See the following code snippet as an example. You can play around with the options in the script for further alignments.
ttitle left "                    TITLE" 
set heading off
set trimspool on
set lines 120
 
column depno heading 'Attribute 5';
column dname heading 'Attribute 6';
 
spool c:\spool\test.txt
select 'Attribute1:  '||empno||'         Attribute2:  '||ename||chr(10)||
       'Attribute3:  '||sal  ||'         Attribute4:  '||deptno
from emp where empno = 7788;
 
ttitle off
set heading on
select deptno , dname from dept where deptno = 10;
 
spool off

Open in new window

0
 

Author Comment

by:chezbrgrs
ID: 20397309
That's an even better way.  Thank you.

chezbrgrs
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video explains what a user managed backup is and shows how to take one, providing a couple of simple example scripts.

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question