SIGN UP MEMBER LOGIN:
   
ARTICLE

Use Spool in SQL*PLUS to Create Text File

Posted by Brijesh Jalan Articles | Oracle August 11, 2010
In this article we will learn how to create Text file of table
Reader Level:

HTML clipboard

Spooling in Oracle (PL/SQL)

Spool is a part of SQL*Plus Session Environment and Stores query results in an operating system file and, optionally, sends the file to a printer.

How to Use Spool

1.Set a Spool result to a text file

Syntax :

SQL> set heading off
SQL> set feedback off
SQL>
SQL> spool C:\brijesh.text

SQL>
SQL> --the brijesh.text is the file name that is created in c drive ---

SQL>

SQL>
SQL> select object_name || '=' || substr (object_name ,1,5) from user_objects
2 where object_type='table';
SQL> select * from emp1;

brijesh   kanpur       20        9335068559
ankit     allahabad    21        9369315513
manoj   tehri           10        2636276762
alicia     UK             22        3239736272
neha      haldwani    21        9335068559
manoj    tehri          10        2636276762
pooja    pits            99        2.4344E+11
aditya   himanchal    23        6.3553E+10
sonika   kanpur        21        5245717281

OUTPUT

spool1.jpg

Login to add your contents and source code to this article
This Feature is Sponsored By
post comment
COMMENT USING
TRENDING UP