Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Substring of a LONG

Re: Substring of a LONG

From: <moerkd_at_my-deja.com>
Date: Fri, 10 Dec 1999 20:46:23 GMT
Message-ID: <82roqv$fhj$1@nnrp1.deja.com>


In article <384E87AE.5BA55726_at_fast.no>,   kev <kevin.porter_at_fast.no> wrote:
> Hi,
>
> I am storing stories in our database in LONG
format. When I pull a few
> out to show on a web page (using PHP), I only
want to pull, say, the
> first 100 characters, then make a link out of it
to the story in full.
> I tried doing a substr(body,0,100) but got an
"Incompatable datatypes"
> error.
> Does this mean the column 'body' must be a
varchar2 to be able to do a
> substr() function in the SQL?
> How do I get round this? I don't want to
retrieve the whole of each
> story body, that would be very inefficient.
>
> thanks,
>
> - Kev
>
>

Use DBMS_SQL to extract the first 2000 Bytes into a varchar2 Variable and the use substr to get the amount of text you need.

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Fri Dec 10 1999 - 14:46:23 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US