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

Conversion from LONG RAW to CLOB ?

Status
Not open for further replies.

areza123

Programmer
Jul 4, 2002
60
0
0
IN
I'm using Oracle 8.1.7. I need to read an
Oracle column which is of data type LONG RAW from my VB application. I know how to read a CLOB thru VB. So I'm doing a

select to_clob(longrawcol) from longrawtable

Is this correct. Is there a better method to do this ?
In short does Oracle provide an efficient method to convert LONG RAW to CLOB ?

 
HI, I found this in Metalink that I think can help you out with your issue.

There is oracle function TO_LOB that converts data stored in LONG and LONG RAW datatypes to CLOB and BLOB datatypes respectively.

The TO_LOB function is provided in Oracle 8.1.x to convert LONG and LONG RAW
datatypes to CLOB and BLOB datatypes respectively.

Example:
SQL> create table long_data (c1 number, c2 long);
Table created.
SQL> desc long_data
Name Null? Type
------------ -------- ----
C1 NUMBER
C2 LONG
SQL> insert into long_data values
(1, 'This is some long data to be migrated to a CLOB');

1 row created.

Note: The TO_LOB function may be used in CREATE TABLE AS SELECT or INSERT...SELECT statements:

Example:
SQL> create table test_lobs (c1 number, c2 clob);

Table created.

SQL> desc test_lobs
Name Null? Type
----------- -------- ----
C1 NUMBER
C2 CLOB

SQL> insert into test_lobs
select c1, to_lob(c2) from long_data;

1 row created.

SQL> select c2 from test_lobs;
C2
-----------------------------------------------
This is some long data to be migrated to a CLOB


References:
===========
Oracle8i SQL Reference Volume 1
[NOTE:66046.1] <ml2_documents.showDocument?p_id=66046.1&p_database_id=NOT> Oracle8i: LOBs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top