trim - not working [message #517917] |
Fri, 29 July 2011 08:17  |
sathik
Messages: 196 Registered: August 2009 Location: INDIA
|
Senior Member |
|
|
I am using trim function in my select query. But still I am getting white space in my output. because of this, I am getting the error "value too large for column... " when I load the data into a table through sqlloader.
Can yo please help me how to avoid the white space effectively?
define APPName="&1"
set heading off;
set verify off;
set newpage 0
set feedback off;
set rtrimspool on;
set termout off;
set pagesize 40000;
set lines 220;
col db_name form a15;
col app_id form a20;
set colsep ',';
col OWNER form a25;
col TABLE_NAME form a35;
COLUMN DB_NAME NEW_VALUE _DB_NAME NOPRINT
SELECT rtrim(NAME) DB_NAME FROM v$database;
COLUMN DB_NAME PRINT
spool &APPNAME._&_DB_NAME._html_table_stats_rpt.csv
select rtrim(sysdate) report_date,
(select rtrim('&APPName') from dual) App_name,
(select rtrim('&_DB_NAME') from dual) db_name,
rtrim(owner),
rtrim(table_name),
rtrim(last_analyzed),
rtrim(NUM_ROWS)
from dba_tables
where owner not in('MGMT_VIEW',
'SYS',
'SYSTEM',
'DBSNMP',
'SYSMAN',
'OUTLN',
'MDSYS',
'ORDSYS',
'EXFSYS',
'DMSYS',
'WMSYS',
'CTXSYS',
'ANONYMOUS',
'XDB',
'ORDPLUGIN',
'SI_INFORM',
'N_SCHEMA',
'OLAPSYS',
'TSMSYS',
'BI',
'PM',
'MDDATA',
'IX',
'SH',
'DIP',
'OE',
'HR',
'PERFSTAT')
and last_analyzed < add_months(sysdate,-1)
order by last_analyzed,owner;
29-Jul-11 APP00111_1 FASTREPE REP2_BACKUP FR_UNEXCEPTED_ERRORS 15-Nov-09 0
29-Jul-11 APP00111_1 FASTREPE REP2_BACKUP AUDIT_DDL 15-Nov-09 0
29-Jul-11 APP00111_1 FASTREPE CDMC_ADMIN CDMCDATA 15-Nov-09 8448042
29-Jul-11 APP00111_1 FASTREPE CDMC_ADMIN CDMC_LOG 15-Nov-09 0
29-Jul-11 APP00111_1 FASTREPE CDMC_ADMIN CDMC_DEBUG 15-Nov-09 0
|
|
|
Re: trim - not working [message #517919 is a reply to message #517917] |
Fri, 29 July 2011 08:22   |
joy_division
Messages: 4963 Registered: February 2005 Location: East Coast USA
|
Senior Member |
|
|
I do not understand. This is a SELECT statement. I do not see anything to do with with SQL*Loader here.
TRIM does not work on columns defined as CHAR as they will be padded with whitespace no matter what do you.
|
|
|
|
|