Problem with export and import and spaces

Problem with export and import and spaces

Post by Miguel Demaere » Sun, 31 Dec 1899 09:00:00



Hoi

I have a problem with export and import.
I have a field that is 50 char long.
With a value of "Test".

When I do an import I get the following
"Test                                             " that is 50 long!.
The field is added with spaces.

How can I remove the spaces?

Is there a option in the export or import utility to suppress spaces?

Thanks in advance
Greetings Miguel

 
 
 

Problem with export and import and spaces

Post by Frank Huben » Sun, 31 Dec 1899 09:00:00


If the field in the table holding "Test" is char, then you would expect
it to be 50 characters long since the entire width of the field will be
used.  To change this create another table like the original one with
varchar2 rather than char as the datatype and insert the data into the
new table.

However, if the datatype of the field is varchar2 and the import file
just has extra spaces, you could use rtrim to trim the fields after the
import occurs.   After you export this table and reimport it there should
be no longer any need of this.

If the table in the export file has a char field and you would like it to
be varchar2, you could open the export file in a hex editor, find the
location of the definition the table and change the field datatype to
varchar2 before importing the data.   You will still have to trim the
data after the import, but the table definition will be varchar2.   This
may sound risky, so make sure you test the process first and backup the
dump file.   However, the only thing that is likely to go wrong is you
will not be using a hex editor when you do the edits and then upon saving
the file everthing will have changed.

Frank Hubeny


> Hoi

> I have a problem with export and import.
> I have a field that is 50 char long.
> With a value of "Test".

> When I do an import I get the following
> "Test                                             " that is 50 long!.
> The field is added with spaces.

> How can I remove the spaces?

> Is there a option in the export or import utility to suppress spaces?

> Thanks in advance
> Greetings Miguel