Extra characters at end of line in spool file

I am trying to generate csv files from SQL Developer using queries written to spool files.  I have embedded the queries and associated set commands in script files and call them, as advised elsewhere.  This gives csv files that look fine, with headings and data comma separated and enclosed with double quotes.  The problem is that the files seem to contain a lot of extra characters at the end of each line.  They seem to be spaces, but not sure.  This is causing problems for the person trying to load the data.
I'm using version SQL Developer 3.1.07.42, Java 1.6.0_11.
Any ideas on how to avoid the extra spaces appearing?  Thanks for any help.
Ben.

Jeff,
The SQL in the script file is below.  To be honest, I have reduced it down to a simple select from dual and it still puts extra spaces at the end of the single line.
col ord noprint
spool test.csv
SELECT  ' ' ord,
  'ZONE_ORDER_NUMBER'||','||
  'ZONE_NAME'||','||
  'ZONE_TYPE'||','||
  'DESCRIPTION'||','||
  'START_DATE'||','||
  'END_DATE'
FROM dual
UNION ALL
SELECT zone_name ord,
  '"'||zone_order_number||'"'||','||
  '"'||zone_name||'"'||','||
  '"'||zone_type||'"'||','||
  '"'||description||'"'||','||
  '"'||TO_CHAR(start_date,'DD-MON-YY')||'"'||','||
  '"'||TO_CHAR(end_date,'DD-MON-YY')||'"'
FROM zones
ORDER BY ord;
spool off

Similar Messages

  • Extra characters at end of file

    I am getting extra characters (carraige returns I think) at the end of these clobs using the source below.
    This only heppens when PL/SQL sends small clobs. We are building xml files from PL/SQL for file system use.
    Any input is appreciated.
    Thanks
    create or replace and compile java source named sjs.write_CLOB as
    import java.io.*;
    import java.sql.*;
    import java.math.*;
    import oracle.sql.*;
    import oracle.jdbc.driver.*;
    public class write_CLOB extends Object
    public static void pass_str_array(oracle.sql.CLOB p_in,java.lang.String f_in)
    throws java.sql.SQLException, IOException
    File target = new File(f_in);
    FileWriter fw = new FileWriter(target);
    BufferedWriter out = new BufferedWriter(fw);
    Reader is = p_in.getCharacterStream();
    char buffer[] = new char[8192];
    int length;
    while( (length=is.read(buffer,0,8192)) != -1) {
    out.write(buffer);
    // out.newLine();
    is.close();
    fw.close();
    CREATE OR REPLACE PROCEDURE sjs.write_CLOB(CLOB_in CLOB,file_in VARCHAR2) AS
    LANGUAGE JAVA NAME 'write_CLOB.pass_str_array(oracle.sql.CLOB,java.lang.String)';
    /

    Jeff,
    The SQL in the script file is below.  To be honest, I have reduced it down to a simple select from dual and it still puts extra spaces at the end of the single line.
    col ord noprint
    spool test.csv
    SELECT  ' ' ord,
      'ZONE_ORDER_NUMBER'||','||
      'ZONE_NAME'||','||
      'ZONE_TYPE'||','||
      'DESCRIPTION'||','||
      'START_DATE'||','||
      'END_DATE'
    FROM dual
    UNION ALL
    SELECT zone_name ord,
      '"'||zone_order_number||'"'||','||
      '"'||zone_name||'"'||','||
      '"'||zone_type||'"'||','||
      '"'||description||'"'||','||
      '"'||TO_CHAR(start_date,'DD-MON-YY')||'"'||','||
      '"'||TO_CHAR(end_date,'DD-MON-YY')||'"'
    FROM zones
    ORDER BY ord;
    spool off

  • Extra space in end of line constant

    Hello All,
    Does anyone have an explanation why when using an end of line constant and a format into string there is an "apparent" extra space included?
    The attached VI (LV 8.5) shows the behaviour. There should not be a space after the "e", but there appears to be. If you view the string in hex form there is clearly not an extra space character. What is going on here, am I misinterpreting how this is supposed to work?
    nrp
    CLA
    Attachments:
    odd.vi ‏7 KB

    Hi nrp,
    Man I was trigger happy.
    I see what you mean, if you step through the 'normal' string you will notice their's a position after the 'e' before going to the next lin.
    This was my original reply (humble, humble)
    I don't really get what you mean but I think you need to remember the 'hex' view is a formatted view, with an additional space after every second character!
    The function returns this for me:
    Which is totally acceptable for me. I see 5 characters ('o','n','e','CR','LF')
    Ton
    Message Edited by TonP on 12-27-2007 04:47 PM
    Message Edited by TonP on 12-27-2007 04:49 PM
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!
    Attachments:
    odd-1_BD.png ‏1 KB

  • Flash Pro CS6 BUG - inconsistent end of line for xml files in library saved in xfl - MESSES UP SVN

    When saving in XFL with Flash CS6 on Mac (it also happened in CS5.5), the generated xml files in library often have inconsistend end of line, which blocks SVN commits and I have to manually go in the files and make them consistent.
    The XML nodes themselves all have \r\l as end of line, while, within <[CDATA[]]>, they only have \r.
    We think this happens only when creating new library items on mac, on windows it doesn't happen.
    This slows us down incredibly when working on a team using svn.
    SVN doesn't upload files with inconsistend line ending.
    Line ending shoul be consistent within the same xml file to make svn operations smooth.
    Check an image of the bug:
    http://www.pippoflash.com/_test/flash_bug_eof.png
    you can see clearly the differences.
    thank you
    Filippo

    Thanks Filippo, I could see that now!
    While I was investigating this, I found that this is even happening on a file created and saved on just Windows. I was able to reproduce this using the following steps
    - Create a new AS3 file on Windows
    - Drag out a component to the stage say a Button component from the User Interface section of the Components panel
    - Convert the button component to a Movie Clip Symbol
    - Save the file as XFL and examine the Library XML files (the End of Line is just 'LF' in CDATA section whereas it is 'CR LF' everywhere else)
    Since you were saying 'Items created in windows have no problem', does that means, SVN can commit those without any issues for you? And do you face problem only when the file is Created and Saved on Mac(where the end of line is just LF every where) but Modified and Re-saved on Windows(where the end of line is inconsistent)? 
    Thanks!
    Mohan

  • Preserve a single space at the end of line using spool command

    Hi,
    Can you please help me to write the result of an sql query into a file with the last column of the row ending with a single space?
    For example:
    COL1DATA|COL2DATA|COL3DATA<space1>
    As mentioned in the example the col3 value in the file should end with a single space. And there should not be any delimiters at the end of the row.
    I tried with set trimspool on/off. But, it didn't work. When I say trimspool on - it is trimming all the trailing spaces.
    When I say trimspool off - it is retaining all the trailing spaces to the size of the line.
    But, I do not wish to modify the file through shell commands once it is written thru spool. I mean I do not wish to append spaces to the end of a line using shell script or any other method.
    I do not wish to use other methods like UTL_FILE also.
    Please help me how to do it using spool command?
    Thank you.
    Ramana

    My requirement is that all the trailing spaces should be truncated except the last one in the row.Why?
    As you have discovered a single column in sqlplus, is always a fixed length regardless of the size of the data, if the length of the data varies the output is padded to the maximum or line size with spaces. The trim and trimpsool commands are there to remove all the spaces from the end of a line if there are any. There are no commands to trim all the spaces except one, or even to trim all the spaces except two, or three even.
    If you want such custom processing you should post process the file in the OS using sed, awk or perl or something designed for such things.

  • Need Spool file 255 characters for background HR Reports into Excel

    We have been looking for a solution for problem this for more than 2 years now.
    Problem:
    1.     Requirement is to run large HR reports – either standard or with Ad Hoc Query in background mode in a company with more than 50,000 employees.
    2.     Nobody wants printed reports these days.  We want to save the forests. Customers prefer to be emailed an Excel file so they can do further data analysis, filtering, pivot tables etc.
    3.     Reports are running OK in foreground for smaller sections of the organisation, where you send the output to Excel from ALV, or save as a local file in spreadsheet format.
    4.     But large reports for entire company are awkward, tie up your PCs resources, and complex reports accessing many tables can timeout before completion.
    5.     So scheduling these reports to run in background would be the ideal solution.
    6.     However when we access the report output from SP02, we find that most reports (say with more than 13 or so fields) have an output wider than 255 characters and the output of the spool file wraps to the next line in Excel.  It is very tricky to then parse the data back into one row for each employee.  And you have a problem if you output is for 50,000 or so employees, because then you file is 100,000 rows and will not load completely into Excel – limit problem of 65,536 characters.
    7.     We simply want a spool file that does not wrap the data to the next line after 255 characters.
    8.     But how to explain this simple requirement to some technical people. It seems a lot of posts on SDN think we always want to print a spool file.  NO – remember the forests!
    Possible Solutions:
    I see a lot of posts here that refer to OSS note 186603, but they don’t mention the target for the output of the spool is to import into an Excel File (i.e. spreadsheet format).  Just search for 186603 or ” Spool request with more than 255 columns”.  There is also a reference to OSS note 313566.  I am not sure if these will work?
    I have also seen the suggestions that you need to define a customer printer format that does not wrap the output after 255 characters (create a new format type in transaction SPAD).
    Can anyone help us!
    John McKee

    Hi,
    Can you please check whether you can use:
    CONSTANTS C_LF TYPE X VALUE '0A'.
    CONSTANTS C_CR TYPE X VALUE '0D'.
    Regards,
    Lakshmi.

  • Seek help to format spool file from SQL*PLUS

    I am running a Unix shell script to call a Oracle 11g SQL script from a Oracle database. In this SQL script, I need to connect to many different remote databases to select data, then sool these records as one big text file to a directory. Then email the file to related Group users. In the spool file, there is a line on the top of each page like this:
    DUMMY
    DB_NAME
    I know this is caused by connect to remote database in SQL*PLUS. My connection string is like this:
    Conn system/password@Oracle_SID
    How can I remove these lines or how to skip these lines into spool file? Please advise. Thanks in advnce. Wish all of you Happy New Year!!!

    Hi,
    It sounds like you have some kind of formatting (such as SQL*Plus TTITLE) producing the output you don't want. If that's the case, temporarily stopping the spooling might not help you. Find out what is causing the output that you don't want. You say that you know it is caused by the CONNECT statements, but it must be more than that. I've written scripts with CONNECT statements that don't have anything like what you reported at the top of each page; in fact, they don't even have pages: the output is one continuous stream. Find out what's putting the unwanted output there, and that will be a big clue as to how you can stop it.
    You say that you know the unwanted titles are there because of the CONNECT statements. If so, use database links instead of CONNECT. You don't have to use dbms_scheduler or utl_file; just eliminate the CONNECT statements. (I'm not saying that there's anything wrong with dbms_scheduler or utl_file; you should definitely investigate those tools. I'm just saying that using database links is independent of them.)
    What would happen if you did all your connecting to different databases at the OS level? Can you write a shell script that connects to each database in turn, and runs a SQL*Plus script in each one. Each SQL*Plus script would have a SPOOL or SPOOL ... APPEND command, or maybe you could build the SPOOL into a LOGIN.SQL script.

  • **Error** Scene 1, Layer 'actions', Frame 1, Line 664: 1087: Syntax error: extra characters found after end of program.

    Scene 1, Layer 'actions', Frame 1, Line 664: 1087: Syntax
    error: extra characters found after end of program.
    I am new to importing classes and I have been practicing
    making a photo gallery. I am stuck and I want to know if someone
    can help me with the error I am getting.
    If it is convenient, you can download and test my .zip at
    www.dhtmlguy.freeservers.com
    Thanks in advance!

    thanks...the small stuff gets me every time.

  • BUG: Extra characters at the end of attachment file names

    I received complaints that my attachments didn't open on the PC's of the recipients. After I saw the messages I noticed there were extra characters at the end of their file names. That's why they wouldn't open. When I looked into my sent mail folder it was there as well. The addition took place when I sent the mail, while composing everything looked fine. It took me a while to realize the pattern. There was one extra for every non-ASCII character in the file name.
    Apparently Mail.app is using two different libraries. The other one counts the non-ASCII characters as two while the other doesn't. I don't know whether Finder still uses MacRoman or Unicode, but this seems to relate to double-byte characters.
    The short term solution is to use only ASCII for file names, but that's not what OS X is all about.

    The class files are broken. Recompile them. If you're uploading them, doublecheck if the FTP program used doesn't do mad things with binary files.

  • Error 1087 extra characters found after end of program.

    Why am I getting the "error 1087 extra characters found after end of program with this code".
    If (counter == 1) {
    Next_btn.addEventListener(MouseEvent.CLICK,KMT1);
    else {
    Next_btn.addEventListener(MouseEvent.CLICK,KMT1);
    function KMT1(event:MouseEvent):void {
      gotoAndPlay("KMT1");

    thanks...the small stuff gets me every time.

  • JMS Adapter - data conversion xml- structured data has extra characters

    Further to [Using MQ / JMS adapter with legacy system to talk to SAP;, I am using the Module tab on my receiver JMS Adapter to convert the xml payload to a structured format. It converts to the mainframe ebcdic code set.  I am on PI 7.11, and the MQ Series (which JMS interacts with) is 6.0.  The code I have is comparable to the wiki:[http://wiki.sdn.sap.com/wiki/display/XI/HowTo...ContentconversionmodulewithJ2EEJMS+adapter], i.e. the example at the very bottom of that article.
    The issue we are having is that an extra character gets inserted at the end of each structure (within the message), i.e. our message contains 4 structures, but when we view the structured data on our mainframe system (that arrives from PI), the entire message is shifted by 4 characters... by 1 after the end of each structure.  On the mainframe, this extra character appears as '.'. It must be an end-of-line or something...
    Has anyone had the same issue?  If so, were you able to resolve? I could probably set up my message data type to just be one big declare (thus eliminating the use of structures within it), but that is something I'd rather not do.
    We are in the process of reviewing Note 856346, #6 but not sure if it applies.
    Regards,
    Keith

    Hi,
    check localejbs/SAP XI JMS Adapter/ConvertMessageToBinary Local Enterprise Bean convert_XI2Bin
    this is not CallJMSService.
    And also check the receiver Structure, if it is falt structure its ok, else
    see the below link if it has the complex structure , how to handle..
    See the below links
    /people/alessandro.guarneri/blog/2006/01/04/jms-sender-adapter-handling-too-short-lines
    /people/william.li/blog/2006/11/13/how-to-use-saps-webas-j2ees-jms-queue-in-exchange-infrastructure
    content conversion
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/f02d12a7-0201-0010-5780-8bfc7d12f891
    Regards
    Chilla..

  • Autocomplete adds characters to end of address

    Hi-- I'm now remembering why I switched to Thunderbird. When I use autocomplete for my addresses, the email usually gets bounced back, and it appears that somewhere along the line a question mark has been added to the end of the address. I have checked for extra characters in my address book and there don't seem to be any. Does anyone know what this problem might be caused by? Thanks.

    Hi McKweiss, and a warm welcome to the forums!
    Try removing the old or bad ones...
    http://email.about.com/cs/macosxmailtips/qt/et101103.htm

  • Apple Script Editor, "Expected end of line but found identifier" Error

    Hello, I'm trying to automate an Application I have, called Self Control, since I have ADD and easily get distracted, and what I want to do is for my computer to automatically set the application up, but to do this, I need a script, which I have already done, but get this error, can someone help me fix this script?
    (the error happens once I click on "run", it tells me as follows: "Syntax Error", followed by, "Expected end of line but found identifier".
    on run argv
    set defaultTime to 1440
    try
      set myTime to item 1 of argv as number
    on error
      set myTime to defaultTime
    end try
    tell application "Usable Keychain Scripting"
      tell current keychain
       set myPass to (password of first generic item ¬
        whose name contains "SelfControl")
       -- eliminate invisible characters, or "gremlins," from password
       set x to quoted form of myPass
       set myPass to do shell script "echo " & x & " | perl -pe 's/[^[:print:]]//g'"
      end tell
    end tell
    tell application "SelfControl" to activate
    tell application "System Events"
      tell process "SelfControl"
       tell slider of window "SelfControl" to set value to myTime
       click button "Start" of window "SelfControl"
      end tell
      tell window 1 of process "SecurityAgent"
       with timeout of 15 seconds
        repeat
         set tryAgain to false
         try
          set value of text field 2 of scroll area 1 of group 1 to myPass
         on error
          delay 1
          set tryAgain to true
         end try
         if not tryAgain then exit repeat
        end repeat
        click button 2 of group 2
       end timeout
      end tell
    end tell
    end run
    I'm no coding expert, but your help would be greatly appreciated. I know that once the script is done I can automate it with Calendar, or even Quicksilver, I just need help with the script.
    Thanks in advance!

    This is a pain with Applescript.
    Could  be a missing " or ' .  I didn't notice this problem.
    Use (* and *) to comment out lines to find where the problem lays. Start big then go smaller and smaller until you find the problem line.  Search internet for examples of the line in question.

  • Technical issue SAP F110 related issue. getting extra characters in outgoing file from sap.

    Hi Technical guru's,
    SAP system creating a outgoing file through F110- t-code, this outgoing file has extra characters (DOC.NO:)
    We need to remove these extra characters. Once Payment run has been carried out through F110, in SM37 in job spool it is showing like screen attached with name “file from sm37”.
    But when we look in to outgoing file directory extra characters as I mentioned above is appearing below is the related screen attached with name “out gooing file”.
    Gurus can anyone please suggest me where I can check about this. I have checked the program available in the job as well in the F110 transaction.But could not find any hint.
    Programs which I find in SM37.
    SAPF110S
    SAPFPAYM_SCHEDULE
    RFFOSE_B
    Programs which are available in F110.
    RFFOAVIS
    RFFOEDI1
    RFFOSE_B
    Does extra  characters coming through functional configuration (DME configuration) or coming through SAP standard programs.
    I am Technical person. I need to solve this issue guys please help me in this.
    If above information is not sufficient  let me know what are the other information should I provide.

    I didn't get any resolution so far also I can't convert into Adobe form because this is a production issue which should be fix by making the requied setting or changes in SAP script itself we can't go for new developmet for this isuue.

  • The best way to read characters from a single line?

    my problem is i have is that 0-5 characters are on one line i need to split this up as each single letter stands for a word i.e - f = football. i need to separate each one. also a person can have up to five hobbies (the letters stand for likes or dislikes) so i also need to think about making sure a reader? stops after the line ends.
    any ideas on the best, most efficient method i could use to overcome this problem?
    thank you Aaron.

    String letters = "fgdat";
    char[] characters = letters.toCharArray();Try that out.

Maybe you are looking for

  • Smartform -Network printer format Issue

    Hi, I can print fine using my YPCC default printer. But When i do through network printer FORMAT is getting Disturbed( Values are printing in next line).How can we handle this? Do we need to do some driver program modifications? Here are the paramete

  • Submit button missing from form, can see it in Pro but not in Reader XI

    I've created and disributed forms in the past with no problem, however, when I open up my form in Reader XI, the submit button is missing.  In the purple ribbon, it instructs people to click the submit button once the form is complete but there is no

  • Regarding vendor master record's creation

    hi sap gurus, can anybody tell me how i can check who(user's id) made (vmr-xk01) in sap. so plz can anybody hel pme out

  • Document Status -- Authorization group?

    Hi, I defined new status values for document in the IMG SolMan project. In addition, i created the document Status schemes with sequence number (Status values). The workflow sequence is working after testing in the Business Blueprint. The problem is,

  • Error while logging in  `ERR-10740 Unable to run custom post-auth process.'

    Hi there, I get the following error only with specific users; some can login, some can't. There is consistency is who receives this error. Error      ERR-10740 Unable to run custom post-auth process. the text of the "Post-Authentication Process" fiel