Re: sqlplus query problem

From: Mark C. Stock <mcstockX_at_Xenquery>
Date: Thu, 4 Mar 2004 08:21:05 -0500
Message-ID: <C7-dndOp-rnQsNrdRVn-sw_at_comcast.com>


"Sean Byrne" <byrne_sean_spamtrap_at_hotmail.com> wrote in message news:c278sn$egd$1$8300dec7_at_news.demon.co.uk...
| Hi,
|
| I'm have trouble with the sql query below... I don't seem to be able to
| remove the trailing whitespace in the first column.
|
| spool E:/work/netcool_WORK_r26a_ab.csv
|
| set feedback off
| set serveroutput on size 100000
| set termout off
| set heading off
| set echo off
| set verify off
| set pagesize 999
| set trimspool on
|
|
| SELECT substr(av1.att_value,1,length(av1.att_value)),
| substr(av1.att_value,1,length(av1.att_value))
| FROM homs.attribute_defs ad1,
| homs.attribute_xref ax1,
| homs.attribute_values av1,
| homs.attribute_defs ad2,
| homs.attribute_xref ax2,
| homs.attribute_values av2
| WHERE ad1.name = '(WEB) HOSTNAME/LOGIN'
| AND ad1.unique_id = ax1.definition_id
| AND ax1.att_val_id = av1.unique_id
| AND ax.object_id = ax2.object_id
| AND ad2.name = 'INETNUM'
| AND ad2.unique_id = ax2.definition_id
| AND ax2.att_val_id = av2.unique_id
|
|
| The first colunm ends up 255 characters wide. How can I prevent this?
|
| Cheers,
| Sean
|

there is no value in the expression
'substr(av1.att_value,1,length(av1.att_value))', simply select av1.att_value

what is the datatype of att_value ? if it is char(255), it will be blank padded, and you need to use trim or rtrim to remove the blanks (or redefine the datatype to varchar2)

[Quoted] if the column's datatype is a varchar2 (as it likely should be), then you have a sql*plus formatting issue, and need to use COLUMN command to set formatting for the output

;-{ mcs Received on Thu Mar 04 2004 - 14:21:05 CET

Original text of this message