Solved

Export Long data type to csv

Posted on 2007-11-28
5
2,133 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 35

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

910 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

23 Experts available now in Live!

Get 1:1 Help Now