Re: How to handle long string ?

From: Wayne Amisano <wayne_at_gbrmpa.gov.au>
Date: Sat, 28 Mar 92 00:25:19 GMT
Message-ID: <1992Mar28.002519.11463_at_marlin.jcu.edu.au>


In article <1992Mar27.150311.22714_at_homecare.COM> billh_at_homecare.COM (Qingnian Bill Huang) writes:
>Hi everybody,
> I am new comer for oracle and have a question regarding LONG datatype.
> Here is the preoblem:
>
>1) I create a table:
> create table mar25
> (ref_code number(4),
> text_line long);
>2) I insert and select from the table by using:
>***************************************************************************
>SET linesize 500
>SET WRAP ON
>DECLARE
> ref_code number(4);
> count_no number(2);
> lline char(4000);
>BEGIN
> count_no := 0;
> lline := 'ihhhhhhhhhhhhhhhhhhhhhhggggggggggggggggggggggggggggggggg'||
> 'ooooooooooooooooooooooooooooooooooooooooooooooooxxxxxxxxx';
> ref_code := length(lline);
> INSERT INTO mar25 (ref_code, text_line)
> VALUES (ref_code, lline);
>END;
>/
>SET HEADING OFF
>SPOOL long.out
>SELECT ref_code, text_line FROM mar25;
>SPOOL OFF
>/
>Set linesize 80
>EXIT
>*************************************************************************
> THE RESULT: From the file "long.out", I just got a number 113, which is
> ref_code (i.e. length(lline)) and first 80 charactors of the "lline"
> and followed by a lot of blank charactors untill 500.
>
> Can you tell me what is happening?
> Thank you.

you don't want SET LINESIZE 500, you maybe want SET LONG 500. you may also have to SET ARRAYSIZE 1 so as you don't get too much info back, in one block, on the comms channel. for instance, ORACLE for the MAC doesn't like chunks of data coming back that are bigger than 32k. it just writes rubbish after after that, i know, it happened to me.

cul 73's de wayne

-- 
Wayne Amisano
GBRMPA                        - Townsvile, Australia
wayne_at_gbrmpa.gov.au           - Internet  |   Life is too important
vk4kt_at_vk4afs.#NQ.QLD.AUS.OC   - PBBS      |   to be taken seriously
Received on Sat Mar 28 1992 - 01:25:19 CET

Original text of this message