How to remove trailing spaces in SQL PLUS spool

Hi,
I've requirement to pull data from tables and I'm using sqlplus spool to automate data fetch from various tables:
I'm using the following script for the same :
set echo off
set feedback off
set pagesize 0
set linesize 2000
set heading on
set trimspool on
Spool table1.TXT;
prompt col1|col2|col3|col4|col5
select
LTRIM(RTRIM(col1))||'|'||
LTRIM(RTRIM(col2)) ||'|'||
LTRIM(RTRIM(col3)) ||'|'||
LTRIM(RTRIM(col4)) ||'|'||
LTRIM(RTRIM(col5)) ||'|'||
from TABLE1 ;
spool off
After using trimspool on option also I'm having trailing spaces issue how to fix it?
Thanks,
Mahender.
Edited by: user518071 on Oct 11, 2010 1:05 PM

Hi,
do you need LTRIM/RTRIM? This is namely your problem. By using a function around your column Oracle reserves the maximum lenght for the column. So what do you get without those functions? Furthermore you are concatenating all the columns. This is also a function. For getting '|' in between columns you can also set a seperator by using
set colsep '|'Herald ten Dam
http://htendam.wordpress.com

Similar Messages

  • How to remove trailing space-sqlldr failed OCI-30951-exceeds max length

    sqlldr failed to load the xml into xdb ( table created through schema registration) because of the padded space in element 'Country' whose maximum length is defined as '3'…Is there any way to remove the extra trailing space using the control file or xdb annotation in the xsd? Thanks!
    <Address>
    <StreetAddress1>1 BRKSTONE SQ </StreetAddress1>
    <StreetAddress2>SUITE 5 </StreetAddress2>
    <City>ANDOVER </City>
    <State>MA</State>
    <Country>USA </Country>
    <ZipCode>01810</ZipCode>
    </Address>
    Here is the errors I got:
    kgepop: no error frame to pop to for error 30951
    OCI-30951: Element or attribute at Xpath /BranchRegulatoryFiling/Branches/Branch[1]/Address/Country exceeds maximum length
    Errors in file :
    OCI-30951: Element or attribute at Xpath /BranchRegulatoryFiling/Branches/Branch[1]/Address/Country exceeds maximum length
    ----- Call Stack Trace -----
    Bus Error (core dumped)
    Here is my ctl file:
    load data
    infile *
    into table xml_stg_tbl
    append
    reenable disabled_constraints exceptions cnstr_xcptn_tbl
    xmltype(XMLDATA)(
    lobfn filler char terminated by ',',
    XMLDATA lobfile(lobfn) terminated by EOF
    BEGINDATA
    /tmp/1025552.xml
    Edited by: user10954036 on Jul 27, 2009 8:12 AM

    Hi,
    Its good that u pasted the complete log file. In your environment you have to run this upgrade tool only once from any of the middle tier.
    And with respect to your error that u got in precheck is quite simple. All u have to do is just run this script from by connecting to portal schema using sqlplus.
    Run dropupg.sql
    Location-------- /raid/product/OraHome_1/upgrade/temp/portal/prechktmp/dropupg.sql
    Later you re-run the upgrade tool and let me know the status.
    Good luck
    Tanmai

  • How to remove trailing space at the end of a song.

    This is related to this thread: Shorten song length (remove trailing bars) in Garageband 10.0.1
    I have also done some Googling and have found some links related to selecting and exporting regions, which I have tried, but this is what I noticed.
    It does not work when I select certain instruments, eg Synthesizer - Soundscape - Subtle Shiftscape or Synthesizer - Lead - Screamlead. I believe that what is happening is that those sounds tend to have some additional length to it. No matter where I cut my region, the additional length still get added. I don't have that problem if I don't select those instruments.
    Anybody has any ideas?

    Are you using GB 10.0.2 as well?
    I am using both - GarageBand 10.0.2 and GarageBand '11.
    And if I deselect all regions, File - Add Region to loop library is of course greyed out. Is it possible to save multiple tracks as a loop?
    No.
    Yep, I've deselected all regions. Still no luck.
    My answer above was in answer to your "This time GB felt I only needed the first 4 measures of the song, even though I defined an entire Region over the length of the song and selected everything with Ctrl-A..."
    You should be able to export the complete song, if you deselect all regions, and select all of the song using the cycle region with "Export Cycle region only" enabled, or with "Export Cycle region only" disabled, nothing selected, and the end-of-song marker correctly set.
    However, this will not get rid of the trailing empty bars.
    Reimport the bounced song to a new Ringtone project and trim it and save it as a tone, or to a regular project and add it to the Loop Library.
    Find the AIFF file of the loop in the Loop library - it will be installed in your User Library in your Home folder
    ~/Library/Audio/Apple Loops/User Loops/SingleFiles/

  • Viewing/Identifying blank spaces in SQL*plus

    How can i identify blank spaces in Sql*plus? How will i know if the result of the following query has the blank spaces on the right trimmed?
    SQL> select rtrim('sxxx  ') from dual;
    RTRI
    sxxxMessage was edited by:
    J.Kiechle

    Why? This seems a pretty strange requirement for me.
    Are you sure that you have a problem with blank padded characters?
    select 1, '|'||rtrim('sxxx  ')||'|' from dual
    UNION
    select 2, '|'||'sxxx  '||'|' from dual;
    Row#     1     '|'||RTRIM('SXXX')||'|'
    1     1     |sxxx|
    2     2     |sxxx  |

  • Export to text removes trailing spaces in XI R2

    I've found an article that talks about the problem of the export to text removing trailing spaces, but the article mentions that this is fixed in Crystal Reports XI with a newer version of u2ftext.dll to version 11.0.0.941.
    [1218375 - Trailing spaces ignored when exporting to Text format|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233313338333333373335%7D.do]
    I'm using Crystal Reports XI R2 and my u2ftext.dll version is already 11.5.11.1470.
    I'm I missing something or is there another solution to the issue in XI R2?
    Thanks,
    Jeff

    2 Years, multiple people are asking this question.......Does anyone in support have a response for keeping the trailing spaces intact during export?

  • How to retreive this file in SQL*Plus

    If I upload files which name is KOREAN, name of files is invisible.
    I dont't know cause of this problem.
    How is keeping korean name of file from breaking?
    Also, answer how to retreive this file in SQL*Plus
    Thanks
    silverbell

    To access ifs data from SQL, you need to (officially) setup a 'user view'. Refer to the Java API documentation on how to do this. Once you have created the user view, then you may access this view using any SQL tool.

  • How to remove white space between two answer reports

    How to remove white space between two answer reports
    In Dashboard section I have 2 rqeuest. Each request renders Table View. When I display dashboard, it show white space separating the 2 table views. How do I get rid of the white space/white band ?

    See this link
    Re: Eliminating the space between two reports in OBIEE dashboard page Section
    Regards,
    Sandeep

  • How to remove trailing zeros from a fraction part.

    How to remove trailing zeros from fraction part, need standard API rather then some java code.

    user8726363 wrote:
    How to remove trailing zeros from fraction part, need standard API rather then some java code.I'm pretty sure we have all gathered that English is not your first language, but your question is not a good question in any language.
    Back up. Take a deep breath.
    Now - what's your problem ?
    Please illustrate with results, and the code (just the class/method; not your entire application) that is causing them.
    Winston

  • How to Generate Trace Files in SQL*Plus

    Hi Friends ,
    How to Generate Trace Files in SQL*Plus ?
    i have no idea
    thanks
    raj

    What trace files would you like to generate?
    Are we talking SQL trace files?
    ALTER SESSION SET sql_trace = TRUE;This will be generated in the user_dump_dest on the server.
    show parameter dump

  • How to find session information in sql plus

    Can someone please tell me how to find session information in sql plus? I specifically want to know my privileges for the current session. Thanks in advance.

    SELECT * FROM session_privs;
    SELECT * FROM session_roles;

  • How to invoke multiple sessions of sql*plus thru pl/sql program

    Hi
    How to invoke multiple sessions of sql*plus thru pl/sql program.
    Thanks

    How to invoke sql*plus in a procedure?????
    I have to invoke more pl/sql sessions?????No you don't "have to".
    Look at what you are trying to do.
    You have a program running inside the PL/SQL engine. This is running nicely inside the Oracle database and is perfectly capable of issuing other SQL statements, PL/SQL programs etc. inside it's nice cosy Oracle environment.
    You are asking for this PL/SQL to shell out to the operating system, run an external application, for which it will have to supply a username and password (are you planning on hard coding those into your PL/SQL?), and then that external application is supposed to run more SQL or PL/SQL against the database.
    a) Why hold all this code external to the database when it can quite happily reside on the database itself and be executed through jobs or whatever.
    b) Consider what would happen if someone were to replace the external application with their own program of the same file name... they'd be able to capture the username and password for connecting to the database, therefore a major security flaw.
    The whole idea of doing what you want through external calls to SQL*Plus is ridiculous.

  • How to remove ghost space on Camera Roll under Usage. No photos on camera. 545MB shown on Camera Roll and 1.8MB on Photo Stream

    How to remove ghost space on Camera Roll under Usage. No photos on camera. 545MB shown on Camera Roll and 1.8MB on Photo Stream?
    Trying to clean up space to download updated iOS. Thanks!
    Have tried unsuccessfully the left swipe and pressing the red delete. No change.

    The only problem is I have only 1.6GB available and need 3.7 to update to the iOS7.  I also have 2.6GB in the "Other" catagory.  How do I access the "Others" area in iTunes in order to see what is there and what I might be able to delete in order to create the amount of space needed.  Thanks for your help!

  • How to remove empty space from a file

    Hi all,
    Can any one help on how to remove the blank spaces from a file.
    I used trim function but unable to remove the spaces.
    I have a file in which there is a name like 'JAIRAM' and am storing this file in a variable FILE_CONTENTS.
    Now am unable to compare FILE_CONTENTS with another value as it is storing empty spaces also from the file.
    Please help on this
    Thanks,
    Srini

    Trim only trim at the beginning or at the end. Can you try using the replace sql function.. see below..
    SQL> select replace('abc def',' ','') from dual ;
    REPLAC
    abcdef
    cheers

  • How to get Arabic dates in SQL*Plus?

    I want to do a very simple thing.
    I want to type in Arabic and Display dates in Arabic.
    Instead i get ????? ??????? ????? ??????? ? ? ???????, ????? for this?
    Why is this?
    I then changed my Windows XP "Regional and Language Options" all to Arabic. Now, I get AR (Arabic) in my language selection bar at the bottom of the Desktop. When I choose AR I can type Arabic in Notepad. ُ
    Even HERE I can type in Arabic: فغحث غخعق ةثسسشلث اثقث
    But in Sql*PLus I get ????? ??????? ????? ??????? ? ? ???????, ?????
    If I choose AR in SQL Plus and type in Arabic I get garbage characters?
    How to get Arabic in Sql*Plus?
    SQL> SHOW USER
    USER is "ARABDTEST"
    SQL> SELECT * FROM v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE    11.1.0.6.0      Production
    TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    SQL> SELECT * FROM nls_session_parameters;
    PARAMETER                      VALUE
    NLS_LANGUAGE                   AMERICAN
    NLS_TERRITORY                  AMERICA
    NLS_CURRENCY                   $
    NLS_ISO_CURRENCY               AMERICA
    NLS_NUMERIC_CHARACTERS         .,
    NLS_CALENDAR                   GREGORIAN
    NLS_DATE_FORMAT                DD-MON-RR
    NLS_DATE_LANGUAGE              AMERICAN
    NLS_SORT                       BINARY
    NLS_TIME_FORMAT                HH.MI.SSXFF AM
    NLS_TIMESTAMP_FORMAT           DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT             HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT        DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY              $
    NLS_COMP                       BINARY
    NLS_LENGTH_SEMANTICS           BYTE
    NLS_NCHAR_CONV_EXCP            FALSE
    17 rows selected.
    SQL> ALTER SESSION set NLS_DATE_LANGUAGE = 'ARABIC';
    Session altered.
    SQL> SELECT TO_CHAR(SYSDATE, 'RRRR/MM/DD YEAR MONTH DAY MON DY AM PM DL') FROM dual;
    TO_CHAR(SYSDATE,'RRRR/MM/DDYEARMONTHDAYMONDYAMPMDL')
    2013/04/08 TWENTY THIRTEEN ?????  ???????  ?????  ???????  ? ? ???????, ????? 08, 2013
    SQL> ALTER SESSION set NLS_DATE_LANGUAGE = 'AMERICAN';
    Session altered.
    SQL>  SELECT TO_CHAR(SYSDATE, 'RRRR/MM/DD YEAR MONTH DAY MON DY AM PM DL') FROM dual;
    TO_CHAR(SYSDATE,'RRRR/MM/DDYEARMONTHDAYMONDYAMPMDL')
    2013/04/08 TWENTY THIRTEEN APRIL     MONDAY    APR MON PM PM Monday, April 08, 2013
    SQL> SELECT * FROM nls_database_parameters;
    PARAMETER                      VALUE
    NLS_LANGUAGE                   AMERICAN
    NLS_TERRITORY                  AMERICA
    NLS_CURRENCY                   $
    NLS_ISO_CURRENCY               AMERICA
    NLS_NUMERIC_CHARACTERS         .,
    NLS_CHARACTERSET               WE8MSWIN1252
    NLS_CALENDAR                   GREGORIAN
    NLS_DATE_FORMAT                DD-MON-RR
    NLS_DATE_LANGUAGE              AMERICAN
    NLS_SORT                       BINARY
    NLS_TIME_FORMAT                HH.MI.SSXFF AM
    NLS_TIMESTAMP_FORMAT           DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT             HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT        DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY              $
    NLS_COMP                       BINARY
    NLS_LENGTH_SEMANTICS           BYTE
    NLS_NCHAR_CONV_EXCP            FALSE
    NLS_NCHAR_CHARACTERSET         AL16UTF16
    NLS_RDBMS_VERSION              11.1.0.6.0
    20 rows selected.

    I am not sure SQL*Plus in character mode can display Arabic characters on Windows. OTN NLS_LANG FAQ http://www.oracle.com/technetwork/products/globalization/nls-lang-099431.html#_Toc105389288 says:
    >
    if you are testing with "special" characters please DO use the GUI and not the "DOS box" sqlplus.exe !
    >
    SQL*Plus GUI is not available with 11G: you should use SQL Developer.

  • How to remove footer space in Table

    I have created a table in main window. after creating main area section, the footer section is appearing as an empty at the bottom. I tried to remove this space by giving zero height to the footer height, but the value is not accepted by the system. How can I remove the space created by the footer?
    rajan

    Hi Rajan,
    Can you please tell me how did you solve this problem ?
    I am facing the same issue in smartforms.
    Regards,
    Nitin.

Maybe you are looking for

  • Compressing an Excel file in SSIS

    J have an SSIS procedure that creates an Excel spreadsheet of 70,000 rows and about 8 columns. The size is 3.5 meg which exceeds the attachment limit and prevents me from sending the spreadsheet as an attachment in my sendmail procedure. Are there an

  • Commisioner of Customs customs duty

    Hi For all the customs duty condition type in Import PO  it should pick the goverment (customs) vendor automatically, where can I set that kindly guide, I dondn't want to change in indvidual PO. Regards Vijikantha

  • Linking bet table

    Hello Guru , guru I m faicing prob to linkin bet VBAK and VBRK table condition is that invoice no should come vbeln field against fkart = zf50 . hw I can link vbak and vbrk , is there any option . plz guide . Thanks in advance .

  • Skippy-xd issues SOLVED

    Hi I cant make slippy-xd downloaded from the AUR, it looks like I dont have permission to make it work. The windows dont scale here is the output : $ skippy-xd --start-daemon WARNING: Couldn't load config file '/home/maxime/.skippy-xd.rc'. --> checki

  • Can't write to a file using File class

    hi every body I wanna write into a file for logging purpose, but I always got an error when I write to the file ... the code is: if(!logFile.isOpen) logFile.open("text", "write") var date = new Date(); if(logFile.canWrite){ trace(">> I will write ...