Unix Technical Forum

Convert LONG to a string

This is a discussion on Convert LONG to a string within the Oracle Miscellaneous forums, part of the Oracle Database category; --> I have an 9i database on Windows 2003 with some mutli-line text stored in a LONG field. I want ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 10:29 AM
Harry331
 
Posts: n/a
Default Convert LONG to a string

I have an 9i database on Windows 2003 with some mutli-line text stored
in a LONG field. I want to seatch this LONG field with a string.

SQL> desc multiline_text;

ENTITY_DBID NUMBER(10)
ENTITY_FIELDDEF_ID NUMBER(10)
DATA LONG

SQL> select multiline_text.data
from multiline_text
where cast(multiline_text.data AS VARCHAR2(132)) like '%Done.' ;

ORA-00932: inconsistent datatypes

How can I convert LONG to a searchable string?

TIA

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 10:29 AM
Mark D Powell
 
Posts: n/a
Default Re: Convert LONG to a string

I do not have a system in front on me to test with but I am fairly
sure that the to_clob function will convert a long datatype to a clob
datatype then you can use dbms_lob functions on the column.

Neither the 9.2 or 10.2 SQL manual entries on to_clob list long as a
valid datatype to the function but it takes every other kind of
character data so it should work.

HTH -- Mark D Powell --

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 10:34 AM
DA Morgan
 
Posts: n/a
Default Re: Convert LONG to a string

Harry331 wrote:
> I have an 9i database on Windows 2003 with some mutli-line text stored
> in a LONG field. I want to seatch this LONG field with a string.
>
> SQL> desc multiline_text;
>
> ENTITY_DBID NUMBER(10)
> ENTITY_FIELDDEF_ID NUMBER(10)
> DATA LONG
>
> SQL> select multiline_text.data
> from multiline_text
> where cast(multiline_text.data AS VARCHAR2(132)) like '%Done.' ;
>
> ORA-00932: inconsistent datatypes
>
> How can I convert LONG to a searchable string?
>
> TIA


Morgan's Library at www.psoug.org
Click on LONG To CLOB
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:23 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com