[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Long Charaters in SQL



HI.  Does anyone know if it is possible to display only the first 50
characters of a field defined as LONG in Oracle?  We are using Oracle
7.28.  I hope to be able to do this in a quey rather than in a SQR.  Any
help is appreciated.  Thanks.

Here is the table description -
SQL> desc ps_benef_comment;
 Name                            Null?    Type
 ------------------------------- -------- ----
 EMPLID                          NOT NULL VARCHAR2(11)
 DEPENDENT_BENEF                 NOT NULL VARCHAR2(2)
 EMPL_RCD#                       NOT NULL NUMBER(38)
 COMMENT_DT                      NOT NULL DATE
 COMMENTS_BY_NAME                NOT NULL VARCHAR2(50)
 ACTION_DT                                DATE
 COMMENTS                                 LONG

The last field on that table is COMMENTS which is defined as LONG.
I wanted to know how to do a select on this field so I could only access
the first 50 bytes. I tried this:  select substr(comments,1,50) from
ps_benef_comment but received this error -

select substr(comments,1,50) from ps_benef_comment
              *
ERROR at line 1:
ORA-00932: inconsistent datatypes

I got out the ORACLE book and it tells me that a field defined as LONG
cannot be used in function arguments, expressions or where clauses and
have certain other restrictions.  I wanted to know if you ever came
across a field defined this way and if so how can it be manipulated to
display only 50 characters.