You are on page 1of 9

DEPARTMENT OF TECHNICAL

EDUCATION ANDHRA PRADESH


Name : M.Bhagya Lakshmi,
Designation : Lecturer in CCP,
Institution : GMR Polytechnic, Gajwel
Branch : DCCP
Semester : V Semester
Major Topic : SQL Plus
Sub –Topic : SQL REPORTS
Subject name : RDBMS
Subject Code : CCP- 505
Duration : 50 min
Teaching Aids : PPT
CCP505.50 1
Objectives:

On the completion of this period , you would


be able to know
 Storing and printing query results

CCP505.50 2
Storing and Printing Query Results

 We can store our query results in a file and can


also print them using SQL*PLUS command
 The command to store query results is
 SPOOL <filename>
 SQL*PLUS stores all subsequent information in
a file until we issue the following command

SQL>SPOOL OFF;

CCP505.50 3
 To print query results the syntax is
SQL>SPOOL OUT;
 After generating the final report using the above
commands one can save them in a file
 To run this file we enter the command
SQL>@<file_name>;

CCP505.50 4
Example:

 Set feedback off


 Set pagesize 15
 Set space 3
 Column Sal FORMAT 9999 heading ‘salary’
 Ttitle ‘employee record skip 1
 Btitle center ‘prepared by ‘XXXX’
 Break on deptno skip page on job skip1
 Compute sum of sal on deptno on report
 Spool x
 Select deptno,job,empno,ename sal from emp order
by deptno
 Spool off
CCP505.50 5
 Spool x
 Select deptno,job,empno,ename sal from emp
order by deptno
 Spool off
 Set feedback on
 Set pagesize 14
 Set space 1
 Ttile off
 Btitile off
 Clear beak
 Clear compute
 Clear column

CCP505.50 6
Quiz

1. ______ COMMAND is used to print query results


a) Spool On
b) Spool Off
c) Spool Filename
d) Spool Out

CCP505.50 7
2. To remove COMPUTE definitions we use
a) Clear break
b) Clear compute
c) Clear column heading
d) all

CCP505.50 8
Frequently Asked Questions

3. Explain about formatting commands used in SQL


PLUS

CCP505.50 9

You might also like