Solved

Formatting Report in Oracle SQL*Plus

Posted on 2007-12-02
4
930 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
  • 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

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Oracle 12c patching 1 88
Processing of multiple cursor 6 47
Oracle SQL 6 60
pivot rows to columns 1 20
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
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 video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
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.

821 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