Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • by gsiems (1343) on 2005.10.13 14:51 (#43878)
    Sounds like your Oracle columns are char datatype. Do you have the option of changing the char columns to varchar2 and then triming the contents of the columns? (that would at least deal with the trailing whitespace issue)
    i.e.:

    SQL> CREATE TABLE temp_ggs (col1 CHAR(2), col2 CHAR(4), col3 CHAR(20), col4 DATE, col5 NUMBER);

    Table created.

    SQL> DESC temp_ggs

    ...

    SQL> SELECT 'ALTER TABLE ' || table_name || ' MODIFY ' || column_name || ' VARCHAR2(' || data_length || ');'
    FROM all_tab_columns
    WHERE data_type = 'CHAR'
    AND table_name = 'TEMP_GGS';

    'ALTERTABLE'||TABLE_NAME||'MODIFY'||COLUMN_NAME||'VARCHAR2('||DAT A_LENGTH||');'
    ---------------------------------------------------------------- ----------------
    ALTER TABLE TEMP_GGS MODIFY COL1 VARCHAR2(2);
    ALTER TABLE TEMP_GGS MODIFY COL2 VARCHAR2(4);
    ALTER TABLE TEMP_GGS MODIFY COL3 VARCHAR2(20);

    3 rows selected.

    SQL> ALTER TABLE TEMP_GGS MODIFY COL1 VARCHAR2(2);

    Table altered.

    SQL> ALTER TABLE TEMP_GGS MODIFY COL2 VARCHAR2(4);

    Table altered.

    SQL> ALTER TABLE TEMP_GGS MODIFY COL3 VARCHAR2(20);

    Table altered.

    SQL> DESC temp_ggs

    ...