Solved

Export Long data type to csv

Posted on 2007-11-28
5
2,112 Views
Last Modified: 2008-02-16
Hi All!,

I wonder if someone dealt with this problem. I have to export into a csv file a long data type field. I work with Oracle 7.3

   set termout off
   set hea off
   set pagesize 0
   spool c:\export.csv
   select       PR_PK||','||PR_DESC
   from F_PROJECT_FILE;
   spool off      

Thank you.


Claudio
0
Comment
Question by:serco_it
5 Comments
 
LVL 34

Accepted Solution

by:
johnsone earned 250 total points
ID: 20365993
I don't think this is possible with SQL*Plus.

You would need to set long to some value large enough to accomodate your largest long.  The maximum appears to be 1073741824, which could be smaller than your long.

You also need to set linesize, the problem with that is that the maximum value for linesize is 32767.  Therefore, SQL*Plus is going to put line breaks into your data every 32767 characters.  I don't think that is what you want.
0
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 20372075
I think that setting long and linesize should get the output you wanted.

Try it and if you are not getting the data output format you wanted, can you post the sample data for 1 record in the table and the expected output.

Also put the current output you are getting so that we can try to help with that to get the expected output.

Thanks
0
 
LVL 34

Assisted Solution

by:Mark Geerlings
Mark Geerlings earned 250 total points
ID: 20374643
I also had to do that with a 7.3 database (more than 10 years ago) and I had the problem that johnsone described: SQL*Plus will put a linefeed character after writing enough charcters to reach your "linesize" value.  I had to then open the file with a text editor, and remove these unwanted line breaks.

Depending on the number of records you have to export, and on the actual size of the data in the column, this may or may not be a significant problem for you.
0
 
LVL 1

Expert Comment

by:Computer101
ID: 20910334
Forced accept.

Computer101
Community Support Moderator
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.

Join & Write a Comment

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now