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

Home -> Community -> Usenet -> c.d.o.misc -> Re: help newbie fromatted ASCII text into cell

Re: help newbie fromatted ASCII text into cell

From: Ben Graham <bengraham_at_xsmail.com>
Date: 21 Sep 2004 03:10:37 -0700
Message-ID: <f858471c.0409210210.735f15f9@posting.google.com>


myfam_at_surfeu.fi (Andrew) wrote in message news:<c5826e91.0409202045.54348112_at_posting.google.com>...
> Hi,
> how do I insert formatted ASCII text like this
>
> [start]
> host=a.b.c # host name
> port=123 # port
> increment=1^2 # increment
> [end]
>
> into a VARCHAR2 cell. My problem is
> a. end of lines (appending ||chr(13) seems to help)
> b. spaces in each should be retained
>
>
> Thanks,
> Andrew

Hi Andrew,

I hope the following example helps:

create table test_table (os varchar2(15),

                         connection varchar2(200))


insert into test_table (os,connection)

values ('unix',
        'host=a.b.c             # host name' || chr(10) ||
        'port=123               # port' || chr(10) ||
        'increment=1^2          # increment') 



insert into test_table (os,connection)

values ('windows',
        'host=a.b.c             # host name' || chr(13) || chr(10) || 
        'port=123               # port' || chr(13) || chr(10) ||
        'increment=1^2          # increment') 


declare

    cursor c is select os,

                       connection
                from test_table;

begin

    for c_rec in c loop

        dbms_output.put_line('----------------------------------------');
        dbms_output.put_line(upper(c_rec.os));
        dbms_output.put_line(c_rec.connection);
    end loop;
end;
/ Received on Tue Sep 21 2004 - 05:10:37 CDT

Original text of this message

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