Carriage Returns in SQL+?

is there a way to force an output file created in SQL PLUS to not pad to the end of the line (set by the set linesize command). I have variable length output, and I want the line to end at the last row, and I don't want the line to wrap.

If you set trimspool on this will stop the line being padded out

Similar Messages

  • Sql Loader and carriage returns

    I am currently trying to use sql loader to load data from flat files that was extracted from sybase using bcp and delimited with pipes. There are text and varchar columns that contain carriage return line feeds. I want to preserve these, but I can not load them into Oracle 8.05 using sql loader as it interprets them as end of record indicators. Does anyone have a way to solve this problem? Any assistance would be appreciated.
    Thanks in advance,
    Jignesh

    External tables are accessible from SQL, which generally simplifies life if the data files are physically located on the database server since you don't have to coordinate a call to an external SQL*Loader script with other PL/SQL processing. Under the covers, external tables are normally just invoking SQL*Loader.
    SQL*Loader is more appropriate if the data files are on a different server or if it is easier to call an executable rather than calling PL/SQL (i.e. if you have a batch file that runs on a server other than the database server that wants to FTP a data file from a FTP server and then load the data into Oracle).
    Justin

  • SQL Loader - Loading Text File into Oracle Table that has carriage returns

    Hi All,
    I have a text file that I need to load into a table in Oracle using SQL Loader. I'm used to loading csv or comma delimited files into Oracle so I'm not sure what the syntax is when it comes to loading a text file that essentially has one value per row and each row is separated by a carriage return. So when you open the text file, the records look like this:
    999999999 <CRLF>
    888888889 <CRLF>
    456777777 <CRLF>
    456555535 <CRLF>
    345688888 <CRLF>
    So each row is separated by a hard return and I need to tell sql loader that the hard return or next row is the next value to insert into the table. Below is an example of a control file I tend to use as a template for loading csv files but I need to modify it to accomodate this new structure.
    OPTIONS (DIRECT=TRUE,ROWS=100000)
    UNRECOVERABLE
    LOAD DATA
    INFILE 'C:\input.txt'
    BADFILE 'C:\input.bad'
    APPEND
    INTO TABLE TEST_TABLE
    FIELDS TERMINATED BY ","
    TRAILING NULLCOLS
    COLUMN_1
    How to I modify the control file above to use hard returns as the field/row delimiter for my text file?
    Thanks

    Hi there,
    Obviously my intention wasn't to post the same message 4 times....I pressed the "Submit Message" button but the submission hung and I pressed it a few times and finally it worked but it created several versions of my post. You need to allow users the ability to delete there own postings...I was looking for this option but didn't have it.
    Sorry

  • Mac - SQLDev 1.5 - Unable to use carriage return/enter in SQL Worksheet

    This morning I brought up SQLDeveloper (1.5). I connected to a database. Started typing in a query and the carriage return (or enter) does not work. If I go to a menu or the list of files, it does work. Just not in the SQL Worksheet. I removed the application and re-installed. Still the same. I do not see this behavior in any other application or situation. Just within the SQL Worksheet of SQLDeveloper.
    As a check, I did exit all other applications, rebooted, and tried again. Still no joy. I have the latest updates of Leopard and SQLDeveloper. I am guessing it is not using the latest Java but rather what was deployed with SQLDeveloper.
    Any thoughts on how I could lose these two keys? There is no change to the system preferences for the keyboard. There is no setup to have the carriage return or enter key be mapped to anything else.
    Very odd. I tried looking around the application and only in the SQL Worksheet does it not work.
    Any ideas?
    Eric

    Ahh, I was pulling my hair out over this since last week (on a PC, not a Mac). I just couldn't figure out why I could no longer add a line feed on the SQL worksheet when I hadn't changed anything at all.
    Anyway, I still have no idea how the settings got changed, but resetting to defaults did the trick. Thanks!

  • Can I preserve carriage returns in a string variable from SQL Server?

    I have an OLE data source that pulls data from sql server via a SELECT query.  One of the fields is an NVARCHAR(max) which goes into a string variable which is later used in an expression.  I am noticing that in the expression, carriage returns
    / line breaks in this field are being lost.  Does anyone know how I can preserve these in the expression?

    Thanks everyone for the suggestions.  I am certain there are both \r and \n in the database as when I print the field and then copy/paste to textedit to show the hidden characters, I can see both the CR and LF's.  
    I have implemented a workaround that is by no means elegant, but it gets the job done.
    I found that \r and \n will evaluate in an expression but if they are part of another string variable, SSIS escapes them. My workaround was to change my OLE_DB select statement (which fetches the custom SQL query) to explicitly change the hidden characters
    to '\r' and '\n' respectively:
    SELECT REPLACE(REPLACE([CUSTOM_SQL],char(13),'\r'),char(10),'\n')
    Then, in my SSIS expression, I de-escaped these characters:
    REPLACE(REPLACE(@[User::vAlertCustomSQL],"\\r","\r"),"\\n","\n")
    Now when the expression is executed, the SQL is formatted correctly and oddly placed comments in the query no longer break the query.  

  • Catching carriage returns in PL/SQL

         Raj Prathinidhi
         07/08/2004 10:51 AM
              To: Venkatesh Kalipi/Corp/Walgreens@Walgreens
              cc:
              Subject: OTN
    I need help to write code that accepts carriage return and converts
    it into a value.
    When I wrote something like
    set serveroutput on
    ACCEPT _value PROMPT 'Please enter a Number :'
    DECLARE
    your_value NUMBER(3);
    BEGIN
    IF NVL(&_value,'\n')='\n' THEN
    your_value:= -10;
    ELSIF &_value is not NULL THEN
    your_value := &p_number;
    ELSE
    your_value:= 0;
    END IF;
    exception
    WHEN OTHERS THEN
    your_value:= 0;
    This code gives an error when I hit "enter".
    Let me know if you have questions. Any help or hints are appreciated.
    Thanks.

    Thanks for the help. I am now able to recognize NULL and carriage return. However, when I enter a numeric, I can't parse it into a variable.
    set serveroutput on
    ACCEPT _value default chr(10) PROMPT 'Please enter a Number :'
    DECLARE
    store_number NUMBER(3);
    BEGIN
    dbms_output.put_line('Print after concat' || &_value );
         IF &_value =chr(10) THEN
                        dbms_output.put_line(Got CR');
         ELSIF &_value is NULL THEN
         dbms_output.put_line('Got Null');
         ELSE
              dbms_output.put_line('I am here');
                        store_number := to_number(&_value); //Doesn't work
         END IF;

  • Oracle Reports 6i Delimied Format and Carriage Returns

    Hi
    I'm using Oracle Reports 6i to generate a report to a text file using delimited format so I can read it in Excel. I've done some testing putting some information in the layout but it seems that all my data is generated in one line. It does not generate the carriage return for the multiple rows I need. Is this standard functionality?. If so, that means I have to generate the file using PL/SQL to get the control I want?

    Whew...lot's of questions...let's see if I can help (at least a little)...
    1. Quite possibly, the user is/was pulling the image from the database? I do this in my environment, so it might be worth a look.
    2. You should be able to print in any format from the web. You may need to adjust your destype/desname/desname parameters.
    3. Only thing I can think of here is that maybe the original report was not written using a standard web-friendly font?
    4. There's a couple of ways you can get data into an excel file:
    A. Use DDE and poke the data right into it (messy when you need to print the regular Oracle report too).
    B. Add an option to print to file and set the desformat to DELIMITEDDATA. Be sure to go through the data model and set Exclude from XML Output to 'Yes' for fields you don't need. Also, be aware that this may not come out in the same order as they do on the printed report. You can read about this on Metalink.
    Hopefully that helps you a little bit. :)
    Chad

  • Reports not retaining carriage returns from htmldb_item.textarea

    I’m created a tabular form for multi row updates using htmldb_item.textarea for one of the fields. When I update the tabular form it keeps any carriage returns in this field, which is good. I then created a “PL/SQL function body returning a SQL Query” report for printing purposes. The problem is that the field populated by the htmldb_item.textarea does not retain any of the carriage returns in the report.
    I enter the following in the textarea on the tabular form:
    Line 1
    Line 2
    Line 3
    The report I created then displays the data as:
    Line 1 Line 2 Line 3
    I need the report to display the data the same as it appears on the tabular form.
    I tried this in my report from reading other similar situations on this forums, but didn’t work.
    replace("TEXTAREA",''||chr(13)||'',''||
    ||'') as title
    Anyone know of a solution?

    How about this?
    Go the page where you can edit the report column attribute - here is the bread crumb to help you figure out what I am talking about
    Home>Application Builder>Application 99999>Page Definition>Report Attributes>Column Attributes
    The second box in this page is Column formatting, you will find 4 text boxes (Number / Date Format, CSS Class, CSS Style, Highlight words) and a text area (HTML Expression). In the text area replace #COLUMN_ALIAS# with <PRE>#COLUMN_ALIAS</PRE>. You will get your newlines without tweaking the query or removing Strip HTML. Strip HTML is a security feature that I would not disable. On the down side you will loose some of the ability to format like fonts etc (:-(,
    Here is why you loose the newlines in the report. When browsers render html they have the liberty to reformat it. When reformating they can play around with whitespaces including new lines. To force a new line you have to use the BR tag or you can say the text is preformated using the PRE tags.

  • Ignore carriage returns in select statement

    Within Oracle Report builder, I am using a select startment
    select descr
    from atable
    "descr" contains carriage returns at the end of the input ie people have enter 'enter' when inputting the data.
    how do write the select statement to ignore the carriage return 'enter' contain within "descr".
    Thanks

    SQL> SELECT 'aa' || chr(10) || 'bb' c FROM dual;
    C
    aa
    bb
    SQL> SELECT translate('aa' || chr(10) || 'bb', chr(10),' ') c FROM dual;
    C
    aa bb
    SQL> SELECT 'aa' || chr(13) || 'bb' c FROM dual;
    C
    aa
    bb
    SQL> SELECT translate('aa' || chr(13) || 'bb', chr(13),' ') c FROM dual;
    C
    aa bb
    SQL> "For Windows"
    Message was edited by:
    mennan
    Message was edited by:
    mennan

  • Carriage Returns in Message Area

    Hi,
    I am using a hidden field "P6_SUBMIT_MESSAGE" to store a message that gets generated from a PL/SQL process. I then use the following trick to display that same message in the message area at the top of my page
    Process success message
    &P6_SUBMIT_MESSAGE.
    How can I get carriage returns into this message. I have tried adding chr(10), chr(13) and even '<'br'>' in the PL/SQL process but no luck. If I use chr(13) and my P6_SUBMIT_MESSAGE is a Textarea (not a Hidden field) I can see the desired results in that text area but even then, the carriage returns are not propagated to the message area at the top of the page.
    Thanks

    I know this is not my thread but i just wanted to say, thanks scott! this works! i'm having the same problem as Robert and tried every possible way like he did with the ch(10) and < b r >... but did not realize to change the page item type, i had it as text area also. Now i changed it to display text (does not save state) and used < b r > for carriage return... it works like a charm!
    Thanks again,
    Marilyn

  • Carriage returns in a textarea are not being stored ??

    Hello developers,
    Ive been looking a couple hours for a solution but cant find it.
    In my app users enter text into a textbox like im doing now.
    When i want to display the text it has lost the carriage returns.
    Im using tomcat and mysql here.
    A solution to deal with the returns ?

    Super thanx, kinda stupid of me i once used that <pre> a couple years ago..
    Its working fine now execpt for the fact tha i have one space before the text starts
    Like this
    sfslfj
    sfsafa
    afsasff
    produced by this code
    <sql:query var="empList" scope="session">
              SELECT * FROM vragen
              ORDER BY vraagnr ASC
         </sql:query>     
         <table width="90%" border="1">
         <c:forEach items="${empList.rows}" var="row">
    <tr>      
    <td border ="0"><c:out value="${row.vraagnr}"/> <td/></tr>
    <tr><td> <pre> <c:out value="${row.vraag}"/> </pre>
         </td>
         </tr>
         </c:forEach>
         </table>

  • Outputting XML carriage return in HTML via XSLT

    Hi,
    I have a scenario where I execute a View Object query in ADF to retrieve results from a particular table in the Database. I then iterate through the results in my Java managed bean and manually construct an XML file with all the appropriate tags. I then pass the XML file through a Transformer class in the Java bean based on an XSLT I have created to produce an HTML page. However I have an issue when it comes to handling carriage returns. One of the database table columns can contain carriage returns within its value but in the final HTML page the carriage returns don't have any effect and the text just displays on one line.
    In the database, the values are stored with the carriage return and in SQL Developer, Toad etc this can be seen e.g. Text1 Text2 Text3 Text4 will display on separate lines. In the XML, the carriage return seems to still be there as when I open the file my element which contains the carriage returns shows each part on a new line e.g. <textElement>Text1
                                                           Text2
                                                           Text3
                                                           Text4</textElement>     (The Text2, Text3 and Text4 all start on a new line at the beginning and there's no prior white space as shown in this post)
    The XML file in JDeveloper also shows carriage return arrow symbols where there is one.
    The HTML page just shows them as Text1 Text2 Text3 Text4 all on one line. Inspecting the source of the HTML shows that the carriage return is in fact there as it also displays as per the XML with the values on separate lines.
    Outputting the value from the View Object in Java to the log shows the value coming out like this - Text1 Text2Text3Text4, which is strange but I know the carriage returns are there so I'm not too fussed about this.
    I have tried escaping the characters in the Java by doing str.replaceAll("[\\r\\n]", ""); (but replacing the "" with &#xD; &#xA; or &x0A;) so in the XML it replaces carriage returns and line feeds with these escaped characters. However, when the XSLT parses the XML it doesn't pick these up and instead actually outputs these actual characters as they are e.g. Text1&x0A;Text2&x0A;Text3&x0A;Text4
    So I can confirm that the carriage return is carrying all the way through to the XSL but I can't help but think that maybe I need to do something in the XSL to process this somehow, e.g. doing the equivalent of the 'replace' in Java but I don't know what I need to search for in the XML and also what to actually replace it with..Do I just replace it with a </BR> in HTML?
    We also parse the XML using PDF and Excel XSL Transformer class and see the same results.
    Any help would be appreciated.
    Thanks

    That's a very commonly asked question.
    HTML doesn't preserve linefeeds, except for the <pre> tag.
    You'll have to replace those characters with <BR/> tags in the XSLT.
    Search the Internet for terms like "XSLT HTML LF", you'll find some XSLT sample templates to handle the replacement.

  • Converting carriage return in HTML spool

    I've written an sql for spooling the result of a Select in HTML format by using "set markup html on spool on head".
    The problem is that when I open the HTML file I no longer find the carriage returns. I mean the carriage returns that were in CLOB field of the table now miss. Could you help me?
    This is the script:
    set pagesize 10000
    set scan off
    set markup html on spool on head ' - '
    column text heading "TEXT"
    spool c:\temp\report.html
    select dbms_lob.substr (t.field, 5000, 1)     text
    from table t;
    spool off;
    exit;
    The "field" contains a long text with carriage returns that aren't in the report.html anymore

    user12180597 wrote:
    I've written an sql for spooling the result of a Select in HTML format by using "set markup html on spool on head".
    The problem is that when I open the HTML file I no longer find the carriage returns. I mean the carriage returns that were in CLOB field of the table now miss. Could you help me?
    This is the script:
    set pagesize 10000
    set scan off
    set markup html on spool on head ' - '
    column text heading "TEXT"
    spool c:\temp\report.html
    select dbms_lob.substr (t.field, 5000, 1)     text
    from table t;
    spool off;
    exit;
    The "field" contains a long text with carriage returns that aren't in the report.html anymoreset preformat to ON:
    set markup html on spool on head ' - ' PRE ON

  • Remove carriage returns from a field in an oracle table

    I have a field that is defined as a LONG in my oracle table; the data contained in this field has carriage returns/line feeds (it's free form text); as i'm selecting data from this field, i need the carriage returns removed so that the data from this field all appears on one line.
    I tried using the TRANSLATE function to convert the carriage returns to something else, but that doesn't work.
    Example:
    Select comment from Notes:
    COMMENT
    the applicant called for an appointment;
    an exam was scheduled for 4/1/05 at 9am;
    called applicant to confirm app
    this needs to be extracted as: "the applicant called for an appointment; an exam was scheduled for 4/1/05 at 9am; called applicant to confirm app"
    How can i do this? Can the decode function be used to remove the carriage returns in this field?

    when i used translate its giving correctly,
    SQL> ed
    Wrote file afiedt.buf
    1 select translate('the applicant called for an appointment;
    2 an exam was scheduled for 4/1/05 at 9am;
    3 called applicant to confirm app
    4 this needs to be extracted as: "the applicant called for an appointment; an exam was scheduled
    5 How can i do this? Can the decode function be used to remove the carriage returns in this field
    6* ',' ') from dual
    SQL> /
    TRANSLATE('THEAPPLICANTCALLEDFORANAPPOINTMENT;ANEXAMWASSCHEDULEDFOR4/1/05AT9AM;CALLEDAPPLICANTTOCONF
    the applicant called for an appointment; an exam was scheduled for 4/1/05 at 9am; called applicant t
    SQL> ed
    Wrote file afiedt.buf
    1 select 'the applicant called for an appointment;
    2 an exam was scheduled for 4/1/05 at 9am;
    3 called applicant to confirm app
    4 this needs to be extracted as: "the applicant called for an appointment; an exam was scheduled
    5* How can i do this? Can the decode function be used to remove the carriage returns in this field
    SQL> /
    'THEAPPLICANTCALLEDFORANAPPOINTMENT;ANEXAMWASSCHEDULEDFOR4/1/05AT9AM;CALLEDAPPLICANTTOCONFIRMAPPTHIS
    the applicant called for an appointment;
    an exam was scheduled for 4/1/05 at 9am;
    called applicant to confirm app
    this needs to be extracted as: "the applicant called for an appointment; an exam was scheduled for 4
    How can i do this? Can the decode function be used to remove the carriage returns in this field?
    SQL>

  • Exporting Text data from PHP to Oracle CLOB data (Carriage return - issue)

    This is my original text content in PHP - Data type - Longtext
    SECTION - 1
    This a test description.This a test description.
    This a test description.This a test description.
    This a test description. This a test description.I exported the above content from PHP as a SQL script file (insert into.. ) - export.sql [ insert into table_name (id, text_content) values (1, '') ]
    while exporting data from PHP table into export file.. it replaced the "Carriage return" with "\r\n\r\n" in the insert statement for text_content column
    When I run this INSERT statement in Oracle (for longtext, I have created a CLOB column in Oracle), the following text_content data is inserted into CLOB column in Oracle.
    SECTION - 2
    This a test description.This a test description.\r\n\r\nThis a test description.This a
    test description.\r\n\r\nThis a test description.This a test description.Now I have created a item named P1_TEXT_CONTENT of type TEXTAREA and try to fetch the CLOB data into this page item.
    BUT textarea displays the entire content including "\r\n\r\n" as mentioned in SECTION - 2
    I want to display the content in textarea (item - P1_TEXT_CONTENT) without "\r\n\r\n" same as the original content with "Carriage return" as mentioned in SECTION - 1
    What are the options we have?
    Thanks,
    Deepak

    DeepakJ wrote:
    I want to display the content in textarea (item - P1_TEXT_CONTENT) without "\r\n\r\n" same as the original content with "Carriage return" as mentioned in SECTION - 1
    What are the options we have?Run an update on the Oracle table following the inserts to replace the escaped CR/LFs with real ones:
    update foo
    set clob_column = replace(clob_column, '\r\n', chr(13) || chr(10));You might want to experiment to see which characters are actually necessary. As an OS X/Linux user I'd probably just use a single LF chr(10).

Maybe you are looking for

  • Unable to release function module

    Working on t001 table , made a structure and use it in function module . importing and export and define the structure in that , save check and activate it. sucessfully activated. then my problem started. After successful activation, Go to the attrib

  • Can parport be used in a applet?

    I have been trying to get parport to read and write in an applet but have had no success. It works fine at the command line but when used in the applet it stops my applet program when it comes to executing the read function. My first idea was keep th

  • How to display binary file saved in BLOB column in Discoverer PLUS /VIEWER

    HI, Friends, I tried to display the binary file saved in the database in BLOB column with the *.doc or *.xls fomats, but it seemed not work at all. I can display them in discoverer DESKTOP, but not the web version PLUS or VIEWER. MY Discoverer PLUS/V

  • RSD No More! Got my MacBook with updated logic board and heatsink

    I've just got back from the Apple store with my freshly repaired MacBook. Since I dropped it in last week, a lot has happened. Most importantly, Apple officially recognised the 'MacBook Shutting Down Intermittently' (aka RSD syndrome) problem. After

  • 0FIGL_C10 and its remote cube

    Hi all, I installed cube 0FIGL_C10 and it came with a remote cube. I would like to execute a query from the remote cube but i cannot seem to execute a query. how do i execute a query from the remote cube, and how does data come in a remote cube? Than