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

Home -> Community -> Usenet -> c.d.o.server -> Re: Updating LONG data type columns

Re: Updating LONG data type columns

From: Dave Pylatuk <davep_at_centurysystems.net>
Date: Wed, 19 Nov 2003 08:37:39 -0500
Message-ID: <pmKub.10469$ZF1.1114849@news20.bellglobal.com>


Thanks very much Anurag.

Would you have any idea if this will only work from pl/sql or if the same logic would work from C++ or another language via ODBC ?

Dave.
"Anurag Varma" <avdbi_at_hotmail.com> wrote in message news:tCzub.12492$st4.8242_at_news01.roc.ny...
>
> "Dave Pylatuk" <davep_at_centurysystems.net> wrote in message
news:XGuub.9213$iT4.991931_at_news20.bellglobal.com...
> > Hello all. I have a question about updating a LONG datatype
> > column in Oracle 8.1.7.
> >
> > I have a STUDENT table like:
> >
> > student_id INTEGER PK
> > student_comments LONG
> >
> > I want to execute a command like this:
> >
> > UPDATE student SET student_comments = student_comments || 'some new
> > comments' WHERE student_id = 1;
> >
> > I am getting an error message indicating incompatible data types.
> > Do I have to do some sort of conversion/cast to add my new
> > comments to the existing ones ?
> >
> > Thanks in advance
> >
> >
> >
>
> Long datatypes have a lot of restrictions.
> I'd advise you to first read the sql reference present on
http://tahiti.oracle.com
> .. In the index browse to LONG -> restrictions.
>
> In your case you could do something like this (using pl/sql):
>
> declare
> v long;
> begin
> select student_comments into v from student where student_id = 1;
> v := v || 'comment';
> update student set student_comment = v where student_id = 1;
> end;
> /
>
> Oracle advises converting long to clob (which have lesser restrictions ..
especially
> 9i onwards).
>
> Anurag
>
>
>
Received on Wed Nov 19 2003 - 07:37:39 CST

Original text of this message

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