Solved

Export Long data type to csv

Posted on 2007-11-28
5
2,184 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 35

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Oracle Query - Return results based on minimum value 8 42
oracle differnce between two timestamps 5 38
Need help on decision table structure 7 45
how to tune the query 17 48
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that useā€¦
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
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 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.

735 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