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  |

Similar Messages

  • How to view  a stored procedure from sql plus

    Can anyone please tell what is the command for viewing the content of the stored procedure from sql plus ?
    Thanks

    Hi,
    I use this simple script to retrieve.......
    EDTRAD@T_E_S_9-->l
    1 select text from all_source where name = 'GET_MAN' -- proc name here
    2* order by line asc
    EDTRAD@T_E_S_9-->/
    TEXT
    FUNCTION get_man (in_man SSBOSS.CLNTWORK.manager%type)
    RETURN varchar2 IS
    CURSOR get_man(in_man SSBOSS.CLNTWORK.manager%type) IS
    SELECT name
    FROM ssboss.clntwork
    WHERE agency = 'TM'
    AND manager = in_man
    AND manager is not null
    AND manager != '**OB**';
    v_man SSBOSS.CLNTWORK.name%type := null;
    BEGIN
    OPEN get_man(in_man);
    FETCH get_man INTO v_man;
    IF get_man%notfound THEN
    v_man := 'Manager Not Found !';
    RETURN (v_man);
    CLOSE get_man;
    END IF;
    RETURN (v_man);
    CLOSE get_man;
    END;
    21 rows selected.
    EDTRAD@T_E_S_9-->

  • 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

  • Code runs correctly when compiled by SQL developer but not SQL Plus

    I have a rather large package body I need to deploy and compile ... It's big and complex (I inherited the project). Our it dept is huge and scripts are deployed by the dba team and they seem to only use sql plus. My code deploys and runs fine when compiled in sql developer. Once I compile it from SQL plus it stops working. It runs and using debug statements I can see the values are correct but it no longer inserts the data into the proper tables. I get ZERO errors or warnings when this is compiled in SQL Plus and no errors are generated from the code at run time. I've diffed the extracts of the code from the DB after each deployment and the only difference is the blank lines which SQL Plus strips out when you load the file. Has anyone run into anything remotely similar and if so how did you solve it? I've tried modifying the code to no avail, adding in comments to preserve the white space makes no difference. The thing that really kills me is that there is no error at all.

    Ok this is the problem area.... vReplyMessage is a clob. I've replaced it in this section of processing with a varchar2(32000). And now it works. I still would like to know why though. Nothing is changed when I load it though sqlplus or sql developer but this line " update swn_recip_response_t set SWN_RECIP_RESPONSE = vTextReply where notification_id = v_notification_id; " would never execute with the clob. Logging showed that the clob had the correct value though. I am puzzled.
    begin
    call_SWNPost('http://www.sendwordnow.com/usps/getNotificationResults',vMessageText, vReplyMessage, v_status_code, v_status_phrase, '');
    exception
    when others then
    raise eJavaException;
    end;
    vTextReply := dbms_lob.substr( vReplyMessage, 32000, 1 );
    if (vDebug) then
    update PEMS_PROD_2.SWN_POST_LOG set response = 'notif_id == '|| v_notification_id || 'status code == '|| v_status_code|| ' '||vTextReply where log_pk = vLogPK;
    commit;
    end if;
    IF v_status_code = 200 then
    v_has_error := 'N';
    ELSE
    v_has_error := 'Y';
    END IF;
    -- we handle all exceptions below in case something goes wrong here.
    -- this area can die silently.
    vTextReply := replace(vTextReply,'<getNotificationResultsResponse xmlns="http://www.sendwordnow.com/usps">', '<getNotificationResultsResponse xmlns:xyz="http://www.sendwordnow.com/usps">');
    begin
    insert into swn_recip_response_t(notification_id) values (v_notification_id);
    exception
    when others then
    if (vDebug) then
    err_num := SQLCODE;
    err_msg := SUBSTR(SQLERRM, 1, 100);
    insert into PEMS_PROD_2.SWN_POST_LOG (LOG_PK, create_date, REQUEST, notification_id) values(pems_prod_2.swn_post_log_seq.nextval,sysdate,
    'err_num - '||to_char(err_num)|| ' error_msg - '|| err_msg, v_notification_id);
    commit;
    else
    null;
    end if;
    end;
    commit;
    begin
    update swn_recip_response_t
    set SWN_RECIP_RESPONSE = vTextReply
    where notification_id = v_notification_id;
    exception
    when others then
    if (vDebug) then
    err_num := SQLCODE;
    err_msg := SUBSTR(SQLERRM, 1, 100);
    insert into PEMS_PROD_2.SWN_POST_LOG (log_pk, create_date, REQUEST, notification_id) values(pems_prod_2.swn_post_log_seq.nextval,sysdate,
    'err_num - '||to_char(err_num)|| ' error_msg - '|| err_msg, v_notification_id);
    commit;
    else
    null;
    end if;
    end;
    commit;
    -- parse through the XML document and update the notification and recipient records
    -- parse the clob into an xml dom object
    begin
    vReplyMessage := vTextReply;
    ...

  • Invoking SQL*Plus from tool or contextmenu bug

    If connection was created using the Basic-Tab everything is fine.
    If used TNS-Tab and network alias sql*plus menu point is greyed out .
    If used TNS-Tab and connect identifier or Advanced-Tab sql*plus is invoke with the wrong
    connect string.
    Example:
    jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=YES)(FAILOVER=YES)(ADDRESS=(PROTOCOL=tcp)(HOST=host1.abc.com)(PORT=51001))(ADDRESS=(PROTOCOL=tcp)(HOST=host2.abc.com)(PORT=51001)))(CONNECT_DATA=(SERVICE_NAME=DEV)))
    Result: sqlplus starts but with wrong connect string
    SQL*Plus: Release 10.2.0.1.0 - Production on Tue Mar 14 10:24:17 2006
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Enter password:
    ERROR:
    ORA-12154: TNS:could not resolve the connect identifier specified
    Enter user-name:
    konsole -e /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/sqlplus apps@jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=YES)(FAILOVER=YES)(ADDRESS=(PROTOCOL=tcp)(HOST=host1.abc.com)(PORT=51001))(ADDRESS=(PROTOCOL=tcp)(HOST=host2.abc.com)(PORT=51001)))(CONNECT_DATA=(SERVICE_NAME=DEV)))

    It does seem to be fairly arbitrary whether SQL*Plus is available or not. I have many connection definitions covering 9i to 11g and SQL*Plus is not available for a random selection of them. They are all defined using the Basic connection tab and I can't see any differences between the one which work and the one which don't.
    It also doesn't make much sense to disable it if the focus is in the sql worksheet and not on a node of the connection navigator.
    Why should it be necessary to define sqlplus as an external tool to get round arbitrary limitations when it should be supported directly.
    I hope these problems are being addressed for the next release.

  • Apex 4.0 - Can see view data in SQL*Plus but no data in Object Browser

    Hi There,
    I have just started using Apex 4.o and migrated some apps. I have an issue with a report, but see the same issue with Object browser, which is easier to describe.
    I have a view:
    create or replace view V_PLJ_USERDEF_CODES (
             CODE_SET_ID,
             CODE_SET_CODE,
             CODE_SET_DESC,
             CODE_ID,
             CODE_SYS_CODE,
             CODE_VALUE,
             CODE_DESC,
             DISPLAY_SEQ,
             DISPLAY_FLAG,
             LANGUAGE_CODE) as
      select CS.CODE_SET_ID,
             CS.CODE_SET_CODE,
             CS.CODE_SET_DESC,
             C.CODE_ID,
             C.CODE_SYS_CODE,
             C.CODE_VALUE,
             C.CODE_DESC,
             C.DISPLAY_SEQ,
             C.DISPLAY_FLAG,
             C.LANGUAGE_CODE
        from PLJ_CODES C,
             PLJ_CODE_SETS CS
       where C.CODE_SET_ID         = CS.CODE_SET_ID
         and CS.CODE_SET_TYPE_CODE = SYS_CONTEXT('PLJUMPSTART','C_USERDEF_CODE_SET');This returns data in SQL*Plus, but no data in Object Browser OR report region based on this view.
    Workspace parses in the same schema as tested in SQL*Plus.
    If, in report, I swap out view, and use underlying table - no problem.
    Any ideas -
    thanks
    P

    Hi all,
    Thanks for getting back so promptly.
    It just seems weird to me, as tables are just fine, but not views.
    In the underlying schema:
    SQL> sho user
    USER is "ICSREPORTING"
    SQL> select count(*) from plj_codes;
      COUNT(*)
           107
    SQL> select count(*) from v_plj_userdef_codes;
      COUNT(*)
            29And in the APEX schema
    SQL> sho user
    USER is "APEX_040000"
    SQL> select count(*) from icsreporting.plj_codes;
    select count(*) from icsreporting.plj_codes
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL> select count(*) from icsreporting.v_plj_userdef_codes;
    select count(*) from icsreporting.v_plj_userdef_codes
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL>However, in SQL browser, I can see the data in PLJ_CODES but in V_PLJ_USERDEF_CODES, just the message "This view has no data". Indeed, it is like this for all views.
    I even explicitly granted access to APEX_040000 but no good.
    In fact, I would like to know more about how Apex gets access to do DML against the underlying parsing schema(s).
    This is a little frustrating though. It worked just fine in lots of apps in version 2.1 to 3.2
    Am I missing something
    paul
    p.s I knew there would be a question about the context, but I had already checked that. :)
    Edited by: PJ on Nov 19, 2010 4:09 AM

  • How to use blank space replace NULL on discoverer viewer

    Hi,
    There is a report that has a varchar field should show text values, and if NULL, I need it show blank space, and does in disco desktop, but on viewer, the same worksheet shows NULL.
    Even I changed in the Tools - Options - Format menu(desktop), it still show NULL on viewer.
    why?
    please help! thanks!
    sammy

    Hi Sammy,
    Unfortunately ‘some’ of the settings set in Desktop do not carry over to Viewer. These options need to be defined for Viewer itself.
    A temporary way to set the Viewer settings is to click on ‘Options’ when logged in Viewer itself. You’ll have to open a responsibility or report before this option becomes available to select. Within here you’ll be able to change the way NULL values are seen. However this method only makes the change for the User you logged in with.
    To make the change for all users, it’s best to edit the PREF.TXT file on the Discoverer Server. Please view the documentation below for more information on how to configure Viewer. For windows platform click here : http://download-uk.oracle.com/docs/html/A90287_01/toc.htm,
    For Unix platform click here : http://download-uk.oracle.com/docs/html/A90288_01/toc.htm. Once you’ve run the applypreference script, these settings will be forced down to all users of Discoverer.
    Hopefully this will help ;-)
    Lance

  • Blank spaces in code view

    Hello,
    Whenever I copy and paste text from another website -- sometimes from my own website after it goes live -- onto Dreamweaver, the text looks just fine in Design view. Fonts and paragraphs are preserved, as they're supposed to according to my preferences.
    However, when I look at the code view, there are always several -- sometimes a whole lot of -- blank spaces separating words; blank spaces that were not in the original text (even in code view) and that can't be detected in Dreamweaver's design view.
    It looks ok online just like it looks ok in Dreamweaver's design view, but I'm just a little concerned that those blank spaces may confuse search engine crawlers.
    For instance. In design view and online, one sees:
    "Great Holiday"
    but in the code view/source page you'll see
    "Great                    Holiday"
    That's what the crawlers and spiders will see as well. And they may think that "Great Holiday" and "Great                    Holiday" are two different sets of keywords when they should be the same.
    How can I ensure that only *one* blank space is allowed in Dreamweaver's code view, whenever I copy and paste text from webpages? Is there a way that I can preserve the texts' format and fonts while ensuring *one* blank space in code view?
    Any suggestions would be much appreciated.

    No, actually this is what happens:
    If one of us copies text from our blog online (www.altfg.com/blog/) we see the following in Dreamweaver's design view:
    Right behind Clash of the Titans, DreamWorks Animation’s How to Train Your Dragon, featuring the voices of Jay Baruchel, Gerard Butler, and
    America Ferrera, earned $3.8 million (+9.2%) domestically on Thursday,
    but in code view there are blank spaces between words. Blank spaces that shouldn't be there:
    <p>Right behind <em><strong><a href=
    "http://www.altfg.com/blog/movies-431/clash-of-the-titans-box-office-predictions/"
    >Clash       of the Titans</a></strong></em>, DreamWorks Animation’s <em>How to   Train Your Dragon</em>, featuring     the voices of <strong>Jay Baruchel</strong>,<strong> <a href=
    "http://www.altfg.com/blog/photos/bradley-cooper-gerard-butler-andrew-r-jones-810/"
    >Gerard       Butler</a></strong>, and <strong>America Ferrera</strong>, earned     $3.8 million (+9.2%) domestically on Thursday, </p>
    Notice the blank spaces separating "featuring      the voices" or "Gerard       Butler." Those shouldn't be there. Maybe it makes no difference. On the browsers, it all looks fine. But is there a way to ensure that Dreamweaver doesn't allow more than one blank space between words in code view?
    Also, *no one* has responded to my query about automatic hyperlinks for images. Any ideas?
    That has been such a drag.
    http://forums.adobe.com/thread/613801?tstart=30
    Thank you.

  • Error creating view with CASE -- WHEN statement in SQL*Plus

    I am using Oracle 8i 8.1.7
    I have an Oracle view which uses CASE...WHEN statements.
    The view compiles fine in DBA studio.
    Using TOAD I saved the view as an *.sql file.
    However, when I try to create the view in SQL*Plus I get the following error:
    SP2-0734: unknown command beginning "CASE WHEN ..." - rest of line ignored.
    According to the documentation CASE -- WHEN has been implemented since since Oracle 8i rel. 2 (8.1.6)

    Well I'm using 8.1.6.3 and CASE and DECODE both work for me:
    SQL> create or replace view v_accs as select account_name, txn,
    2 decode(credit, 0, 'DB', 'CR') t_type
    3 from accs;
    View created.
    SQL> select * from v_accs;
    ACCOUNT_NA TXN T_
    APC 1 DB
    ABC 2 DB
    HJJ 3 DB
    HJH 4 CR
    HJK 5 CR
    APC 6 DB
    APC 7 DB
    ABC 8 DB
    ABC 9 DB
    HJJ 10 DB
    HJJ 11 DB
    HJH 12 DB
    HJH 13 DB
    HJK 14 DB
    HJK 15 CR
    15 rows selected.
    SQL> create or replace view v_accs as select account_name, txn,
    2 case when credit = 0 then 'DB' else 'CR'end as t_type
    3* from accs
    View created.
    SQL> select * from v_accs;
    ACCOUNT_NA TXN T_
    APC 1 DB
    ABC 2 DB
    HJJ 3 DB
    HJH 4 CR
    HJK 5 CR
    APC 6 DB
    APC 7 DB
    ABC 8 DB
    ABC 9 DB
    HJJ 10 DB
    HJJ 11 DB
    HJH 12 DB
    HJH 13 DB
    HJK 14 DB
    HJK 15 CR
    15 rows selected.
    SQL>
    rgds, APC

  • Before header pl/sql process creates blank space at top of page

    Hi,
    I'm finding that w/v 1.6.1 I get a blank space at the top of my page that appears to be somewhat proportional to the amount of code and/or # processes on that page that are before header. moving to after header and before regions also shows this behavior.
    There are no blank line outputs happening in the pl/sql processes, so I've got no idea why htmldb is putting blank space there.
    Anyone seen anything like this? Oracle 9.2.0.7, winxp pro
    Thanks
    matt

    Hi,
    I've had the same problem. I'm assuming that you have a region in the "After Header" position?
    If so, you could add the following in the region's Region Header:
    &lt;div style="display:none"&gt;
    and put this in the Region Footer:
    &lt;/div&gt;
    The region is defined in a table, which by definition is a block object. Block objects always begin on a new line and end with a new line - the above will put the region into a div and then hide the div.
    Regards
    Andy

  • VIEW XML IN SQL*PLUS

    how can we view xml on sql*plus?
    when xmltype is viewed on sql*prompt it shows incomplete xml.
    example:
    SQL> select xmlelement("ROOT",xmlforest(1 as A, 2 as B, 3 as C)) from dual;
    XMLELEMENT("ROOT",XMLFOREST(1ASA,2ASB,3ASC))
    <ROOT>
    <A>1</A>
    <B>2</B>
    <C>3</C>
    </ROOT>
    but i generate an xml from table so it becomes quite huge. say a forest is populated with 6-8 tags. it shows broken output.
    SQL> /
    ID LIST
    <DEPT>
    <EMPLOYEE>
    <ID>2109</ID>
    <ID>3108</ID>
    <ID>4107</ID>
    <ID>5106</ID>
    <ID
    i have tried increasing bufferwidth and bufferlength tp max value (1000 and 2000 respectively) eventhen it displays the output as shown above.
    how can i view my xml?

    use this sql plus command:
    set long 2000000
    You can increase\decrease the value as required.

  • Need to find out View definition by SQL PLUS

    Hi,
    I have a view VW_XXX, I want to know by which table this view has created. But need to use only SQL PLUS not any tool.
    Please let me know how cani see the full definitio of the view by SQL PLUS.
    Regs,
    brij

    Yes, it will work for both 9i and 10g. Just run the commands, and you will get the output.
    These are not "Dangerous Commands!!!"
    Regards
    Girish Sharma
    Edited by: Girish Sharma on Dec 26, 2011 5:19 PM
    To solve these issues Oracle9i has introduced the DBMS_METADATA package which can be used to retrieve object definitions as DDL or XML. There are a number of ways to use the API, but I suspect the majority of people will only ever use the following functions.
    Source:http://www.oracle-base.com/articles/9i/MetadataAPI.php
    Edited by: Girish Sharma on Dec 26, 2011 5:36 PM
    And here it is doc link :
    http://docs.oracle.com/cd/A91202_01/901_doc/appdev.901/a89852/d_meta11.htm#1024701

  • Viewing tables in sql plus

    hai friends.,
    i created a java database pgm using jdbc:odbc connectivity, that creates a table in the database and i inserted some records in that table. how can i view those table and records in the sql plus. what commands are used to view those table
    regards.,
    sekar

    Hi sekar,
    Interesting, you're able to do a 'CREATE TABLE bla...' but are not familiar with 'SELECT'? I would suggest to read some basic stuff about SQL statements. What will you do when the next task is: "Hey, I need a pgm to change these values in the table!"?
    Regards,
    Guido

  • Viewing Binary data in SQL*PLUS

    hi all,
    when i select a table to view the content, i received an error which i shown below.
    SP2-0678: Column or attribute type can not be displayed by SQL*Plus
    the error seems that the binary data cannot be view thru SQL PLUS.
    do anybody have idea to solve this issue.
    thanks in advance
    karthik.J

    Probably you are trying to view BLOB data. Try this to view the data:
    SQL> CREATE TABLE t (a BLOB)
      2  /
    Table created.
    SQL> INSERT INTO t
      2       VALUES (UTL_RAW.cast_to_raw ('Hello World'))
      3  /
    1 row created.
    SQL> SELECT UTL_RAW.cast_to_varchar2 (a) a
      2    FROM t
      3  /
    A
    Hello World

  • Encoding for blank spaces in url in a sql statement in report

    1. What function or process do I use to encode for blank spaces in a url link in a report?
    I need to link from a report to a 2nd report and pass 5 variables. I believe that I need to do that by embedding my own url in the sql for the report, since the standard report sets up for only 3 variables to be passed.
    One of my variables PARTNER_FIRM has spaces in it, so how do I encode for that in the query. Currently, I have the following (... simplified).
    select partner_firm,
    count(distinct event) distinct_events,
    '<a href="f?p=18509:4:&SESSION.::NO:4:P4_PARTNER_FIRM,P4_QUARTER,P4_CATEGORY,P4_PRODUCT_CATEGORY,P4_EVENT:' ||
    partner_firm ||
    '%2C&P3_QUARTER.%2C&P3_CATEGORY.%2C&P3_PRODUCT_CATEGORY.%2C&P3_EVENT.">' ||
    count(distinct lower(attendee_email)) || '</a>' distinct_attendees
    from all_events ...
    but partner_firm has spaces which are returned. I think there is some way that I can encode for that?
    Thanks,
    Stephen

    Sure there is:
    select apex_util.url_encode('http://ww.oracle.com/') from dual
    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    You can reward this reply by marking it as either Helpful or Correct ;-)

Maybe you are looking for

  • Hey Is there any way to sub-divide Playlists

    I know this is getting really anal but I would really like to be able to set-up a playlist or something like it with an artist or band and then be able to sub-divide that playlist by album. Maybe I am going about this wrong I just don't like any of t

  • [Tips & Tricks] Beginners guide to Bloodborne

    There is no doubt Bloodborne will be a difficult game. But do not fear, it's not unbeatable and as long as we stand together as a community we will manage it! Let's use this guide to help all the beginners and newbies, especially those who have never

  • How can I change my itunestore location?

    Hello, Could you`please help me in Change the location of my Itune store? Now I have the Itune store from Spain and I want to change to the Store in the U.S.A. I have tried to do that but a message about  cancel a suscription in ItuneMatch appear.I d

  • About Some Interview Questions

    Hi Friends , Here are the some questions which i was unable to answer ... pls give a reply for dis answers 1. In direct input method the data is uploaded on application server in which of the following file . a.logical file b.physical file c. the dat

  • System copy/system refresh

    Hi Experts, Our dev,qty, prd system donu2019t have exact replica in terms of objects in interfaces. Few changes made at object level in  production system is not done in qty system. To make all the 3 systems containing same objects what need to be do