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

Re: Long Charaters in SQL



Thanks everyone.  The Set command worked great.

>----------
>From:  Stephen C. Lorenz[SMTP:slorenz@SEAHAWK.NSCC.MASS.EDU]
>Sent:  Thursday, January 29, 1998 10:05 AM
>To:    Multiple recipients of list SQR-USERS
>Subject:       Re: Long Charaters in SQL
>
>Robert,
>
>If you are hoping to use a sqlplus script for your report, you can use the
>"set long 50" command.  This will truncate all long datatypes to 50
>characters in length.
>
>Hope this helps.
>Steve
>
>-----------------------------------------------------------------------------
>-
>>  Stephen C. Lorenz -- Systems Analyst | North Shore Community College
>><
>>  slorenz@nscc.mass.edu                | 1 Ferncroft Rd, Danvers, MA 01923
>><
>-----------------------------------------------------------------------------
>-
>
>On Thu, 29 Jan 1998, Budzinski, Robert wrote:
>
>> 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.
>>
>>
>