Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with spolling to a file (Oracle)

Status
Not open for further replies.

tiver43809

IS-IT--Management
May 6, 2005
72
0
0
US
I am trying to send the results of a query to a file.
My problem is one of the fields is long which means it oould have up to 2 gig worth of data. I tried this below but I am still not sure i am getting everything out. What I would like to do is run a query that will show the number of characters in each field of my table. That way I might be ablt to use longchunk. Any ideas?
Thank You,
In over his head Terry

SET PAGESIZE 10000
SET LINESIZE 130
SET LONG 5000
select tsxre2,tsddat,tscomm,tmrmks,tsxref,tsidat,tspoci,tsbldg,tsroom,tsname,tsntel
from tsr,tsrrmk
where tsnumb=tmnumb and tscdat is null
order by tsxre2
 
SET PAGESIZE 10000
SET LINESIZE 130
SET LONG 5000
SPOOL <filename and path>
select tsxre2,tsddat,tscomm,tmrmks,tsxref,tsidat,tspoci,tsbldg,tsroom,tsname,tsntel
from tsr,tsrrmk
where tsnumb=tmnumb and tscdat is null
order by tsxre2
SPOOL OFF

-------------------------
The trouble with doing something right the first time is that nobody appreciates how difficult it was - Steven Wright
 
To create a flatfile:
SET SERVEROUTPUT ON SIZE 1000000 (or larger if needed)
SET NEWPAGE 0
SET SPACE 0
SET PAGESIZE 0 (one continuous page)
SET LINESIZE ? (not sure if 0 works)
SET ECHO OFF
SET FEEDBACK OFF
SET HEADING OFF
SPOOL <filename and path>
query
SPOOL OFF


-------------------------
The trouble with doing something right the first time is that nobody appreciates how difficult it was - Steven Wright
 
A few ideas about it:

1) You might get more help, if you asked in an Oracle specific forum. There are quite a few here at Tek-Tips.

2) You might get more useful answers, if you provided more information about your problem, e.g. Oracle version and data type of your columns.

3) That being said, I am supposing the Oracle data type of the columns in question might be long.
In this case you will not get the part exceeding 5000 characters, because of your 'SET LONG 5000'. (You probably already knew!)
And finding the maximal length may be tricky; have a look at

hope this helps
 
THANKS
I was able to use the second part here at our test site. We do not have anywhere the notes in that one field so I am not sure what it look like when I run it there. I am trying the function create now.
Thanks Again
Terry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top