Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 938
  • Last Modified:

Formatting Report in Oracle SQL*Plus

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
chezbrgrs
Asked:
chezbrgrs
  • 2
1 Solution
 
sonicefuCommented:
Are you using oracle reports ?
0
 
chezbrgrsAuthor Commented:
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
 
sujith80Commented:
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
 
chezbrgrsAuthor Commented:
That's an even better way.  Thank you.

chezbrgrs
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now