sql - Getting extra trailing spaces in each column when using lpad in Oracle -
sql - Getting extra trailing spaces in each column when using lpad in Oracle -
i running below query using shell script info oracle.
set heading off; set colsep ","; set echo off; set feedback off; set pages 0; set tab off; set linesize 10000; select nvl(lpad(id1,9,' '),' '), id2, lpad(id3,11,' '), nvl(id4,' ') entmst.t_db_entity; quit;
and getting output below.
197329691 ,197329691, 197329691 ,197329691
for example, 3rd column lpad working fine value 197329691 getting space after that. how can remove those?
add aliases each column:
select nvl(lpad(id1,9,' '),' ') id1, id2 id2, lpad(id3,11,' ') id3, nvl(id4,' ') id4 entmst.t_db_entity;
set sql plus column width preceding select statement:
col id1 format a9 col id2 format a9 col id3 format a9 col id4 format a9
sql oracle plsql oracle11g oracle10g
Comments
Post a Comment