Solved

Export Long data type to csv

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

Suggested Solutions

Title # Comments Views Activity
Oracle sql query 7 74
clob to char in oracle 3 62
capture vmstat info and insert it into an oracle table 31 35
Need SQL Query to Find Foreign-keys Without Indexed Columns 4 25
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
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 shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…

856 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