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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting LONG type

Status
Not open for further replies.

toddyl

Technical User
Sep 26, 2005
102
US
Hi,

I have a table and one of the columns, say x, is of type LONG. I can do a select a, b, c, x from my_table and have no problems in getting the data I require.

I now want to output this to a csv file so I set spool to a file, say output.csv and run the following:

spool ../../output.csv
select a||','||b||','||c||','||x
from my_table;
spool off;

When I run this I get an oracle error:

ORA-00932: inconsistent datatypes: expected NUMBER got LONG

Can anyone help me in extracting this data to csv format.

Thanks.
 
Yes, LONGs are notoriously useless, which is why they have been replaced by CLOB and BLOB. The only way I've ever found to manipulate them is to use PL/SQL and retrieve the long into a large PL/SQL variable (32k). You can then output it to a file using UTL_FILE or write to another intermediate table. You will still have problems if the LONG is > 32k.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top