Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Substring of a LONG
You can't do much with a LONG, including SUBSTR. Here's one way around the
problem. Create another column (or table- your choice), but the idea is that
the column is a VARCHAR2(100) and contains the first 100 characters of your
LONG. You search on the VARCHAR2 field, but show the LONG in the result.
kev <kevin.porter_at_fast.no> wrote in message
news:384E87AE.5BA55726_at_fast.no...
> 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
>
Received on Wed Dec 08 1999 - 11:19:01 CST
![]() |
![]() |