Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does Char(1) change to Char(3) when copying over an Oracle DBLINK?
    primarykey
    data
    text
    <p>I have 2 databases, and <strong>I want to transport an existing table containing a CHAR column from database A to database B.</strong></p> <p>Database A is Oracle 9i, has encoding WE8ISO8859P1, and contains a table "foo" with at least 1 column of type CHAR(1 char). I can not change the table on database A because it is part of a third party setup.</p> <p>Database B is my own Oracle 10g database, using encoding AL32UTF8 for all kinds of reasons, and I want to copy foo into this database.</p> <p>I setup a database link from database B to database A. Then I issue the following command:</p> <p>*create table bar as select * from #link#.foo;*</p> <p>The data gets copied over nicely, but when I check the types of the columns, I notice that CHAR(1 char) has been converted into CHAR(3 char), and when querying the data in database B, it is all padded with spaces.</p> <p>I think somewhere underwater, Oracle confuses it's own bytes and chars. CHAR(1 byte) is different from CHAR(1 char) etc. I've read about all that.</p> <p><strong>Why does the datatype change into a padded CHAR(3 char) and how do I stop Oracle from doing this?</strong></p> <p><em>Edit: It seems to have to do with transfering CHAR's between two specific patchlevels of Oracle 9 and 10. It looks like it is really a bug. as soon as I find out I'll post an update. Meanwhile: don't try to move CHAR's between databases like I described. VARCHAR2 works fine (tested).</em></p> <p><em>Edit 2: <strong>I found the answer and posted it here:</strong> <a href="https://stackoverflow.com/questions/253971/why-does-char1-change-to-char3-when-copying-over-an-oracle-dblink#263467">Why does Char(1) change to Char(3) when copying over an Oracle DBLINK?</a> Too bad I can not accept my own answer, because my problem is solved.</em></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload