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: Trailing spaces trimmed by default?

Re: Trailing spaces trimmed by default?

From: EscVector <Junk_at_webthere.com>
Date: 7 Nov 2006 08:36:21 -0800
Message-ID: <1162917381.031063.285550@m7g2000cwm.googlegroups.com>

Tarby777 wrote:
> Hi all,
>
> When doing either of these operations in 9i:
>
> create table x as (select * from y);
>
> insert into x(a,b,c) (select a,b,c from y);
>
> ...does Oracle trim trailing spaces from varchar2 columns by default
> and if so, can it be over-ridden? I'm losing some trailing spaces from
> my data during an upgrade and I suspect that one of these operations is
> causing it but I've not been able to reproduce the problem in tests...
>
> TIA
> Tarby

Here's a test in 10g. Will also test in 9.2.0.7 No timming. :)
Also, in line view is when the FROM is a select. The parens here make no difference...

11:32:05 SQL> create table test(col1 varchar2(10));

Table created.

Elapsed: 00:00:00.01
11:32:17 SQL> insert into test values (' ');

1 row created.

Elapsed: 00:00:00.00
11:32:34 SQL> select length(col1),col1 from test;

LENGTH(COL1) COL1
------------ ----------

          10

Elapsed: 00:00:00.00
11:32:55 SQL> create table test2 as select * from test;

Table created.

Elapsed: 00:00:00.39
11:33:31 SQL> insert into test2 select * from test;

1 row created.

Elapsed: 00:00:00.00
11:33:46 SQL> select length(col1),col1 from test;

LENGTH(COL1) COL1
------------ ----------

          10

Elapsed: 00:00:00.00
11:34:03 SQL> select length(col1),col1 from test2;

LENGTH(COL1) COL1
------------ ----------

          10
          10

Elapsed: 00:00:00.03
11:34:13 SQL> insert into test2 (select col1 from test);

1 row created.

Elapsed: 00:00:00.00
11:35:22 SQL> select length(col1),col1 from test2;

LENGTH(COL1) COL1
------------ ----------

          10
          10
          10

Elapsed: 00:00:00.01
11:35:27 SQL> Received on Tue Nov 07 2006 - 10:36:21 CST

Original text of this message

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