Formatting Report in Oracle SQL*Plus

Posted on 2007-12-02
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:

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

Attribute 5                                         Attribute6
Data                                                  Data

The Attributes are headings.
Thanks for any help you can provide.
Question by:chezbrgrs
  • 2
LVL 13

Expert Comment

ID: 20393721
Are you using oracle reports ?

Author Comment

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

Accepted Solution

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


Author Comment

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


Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Introduction A previously published article on Experts Exchange ("Joins in Oracle", makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now