How to use oracle TRIM functionality in XML messages

When i am selecting data from XML message as per below query, it is returing values correctly.
SELECT extractValue(x.column_value, '/DETAILS/EMPID') as emp_id,
extractValue(x.column_value, '/DETAILS/NAME') as emp_name,
extractValue(x.column_value, '/DETAILS/SALARY') as emp_sal
FROM TABLE(
XMLSequence(
Extract( xmltype('<DETAILS><EMPID>2482</EMPID><NAME>SMITH</NAME><SALARY>4854</SALARY><LOC>CHENNAI</LOC></DETAILS>'),'/DETAILS'))) x;
But when i am selecting data by using below query some additional spaces also coming with column values
SELECT extractValue(x.column_value, '/DETAILS/EMPID') as emp_id,
extractValue(x.column_value, '/DETAILS/NAME') as emp_name,
extractValue(x.column_value, '/DETAILS/SALARY') as emp_sal
FROM TABLE(
XMLSequence(
Extract( xmltype('<DETAILS>
               <EMPID>
                         2482
                         </EMPID>
                         <NAME>
                         SMITH
                         </NAME>
                         <SALARY>
                         4854
                         </SALARY>
                         <LOC>
                         CHENNAI
                         </LOC>
                         </DETAILS>'),'/DETAILS'))) x;
Please suggest how to remove additional spaces by using second query.
Thanks
Vikrant Jain.

It appears that the ability to use XPath functions in the PATH expression doesn't work prior to 11g :
Connecté à :
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> var xmldoc varchar2(4000)
SQL> begin :xmldoc := '<DETAILS>
  2  <EMPID>
  3  2482
  4  </EMPID>
  5  <NAME>
  6  SMITH
  7  </NAME>
  8  <SALARY>
  9  4854
10  </SALARY>
11  <LOC>
12  CHENNAI
13  </LOC>
14  </DETAILS>';
15  end;
16  /
Procédure PL/SQL terminée avec succès.
SQL> SELECT emp_id, emp_name, emp_sal
  2    FROM XMLTable('/DETAILS'
  3                  PASSING XMLTYPE(:xmldoc)
  4                  COLUMNS
  5                  emp_id     NUMBER        PATH 'normalize-space(EMPID)',
  6                  emp_name   VARCHAR2(20)  PATH 'NAME',
  7                  emp_sal    VARCHAR2(20)  PATH 'SALARY');
SELECT emp_id, emp_name, emp_sal
ERREUR à la ligne 1 :
ORA-31011: Echec d'analyse XML
ORA-19202: Une erreur s'est produite lors du traitement la fonction XML (
LPX-00601: Invalid token in: '/*/normalize-space(EMPID)')Using it in XQuery will work though :
SQL> SELECT *
  2  FROM XMLTable(
  3   'for $i in /DETAILS
  4    return element r
  5    {
  6     for $j in $i/*
  7     return element {local-name($j)} {normalize-space($j)}
  8    }'
  9   PASSING XMLTYPE(:xmldoc)
10   COLUMNS
11     emp_id     NUMBER        PATH 'EMPID',
12     emp_name   VARCHAR2(20)  PATH 'NAME',
13     emp_sal    NUMBER        PATH 'SALARY'
14  );
    EMP_ID EMP_NAME                EMP_SAL
      2482 SMITH                      4854

Similar Messages

  • How to use Essbase @RETURN function to displayed messages in 11.1.2.1

    Hi,
    I found Business Rule support Essbase @RETURN function in Hyperion Planning 11.1.2.1 new feature.
    If I create a simple BR for planning app as below:
    "@RETURN("test return message" , WARNING);"
    The validation returns error and BR can not be deployed.
    Does any one how to use @RETURN function in BR?
    Thanks!

    Hi,
    From Essbase Technical Reference Guide: http://download.oracle.com/docs/cd/E17236_01/epm.1112/esb_tech_ref/frameset.htm?launch.html
    Example+
    The following example stops the calculation and returns a custom warning message if maximum values specified in the IF statement are empty:+
    FIX("Actual")
    . "Profit"(
    IF( ("Marketing" < 0) OR ("Payroll" < 0) OR ("Misc" < 0) )
    @RETURN( @CONCATENATE(
    @CONCATENATE("The violation of data integrity : Market [", @NAME(@CURRMBR("Market"))),
    "] has a negative expenses. Calculations are interrupted")
    , WARNING);
    ELSE
    "Profit" = ("Margin" - "Total Expenses")*0.9;
    ENDIF
    ENDFIX
    Cheers,
    Alp

  • How to use oracle nlssort function in order by clause?

    If I need to use linguistic sort feature in Oracle, I can write a SQL like that:
    Select product_name from product
    order by NLSSORT(product_name, 'NLS_SORT=GENERIC_M');
    How can I generate a SQL like this by Toplink?

    Hi,
    To answer your query:-
    http://abhishek-soablog.blogspot.com/2008/08/orclquery-database.html
    Cheers,
    Abhi...

  • How to use xsl document() function with LiveCycle XSLT processor

    Hello,
    I would like to use LiveCycle XSLT processor to merge xml documents by using the xsl document() function.
    However, I have not, yet, found  clear reference information on the specifics of how to accomplish in LC. For instance if you have
    a transformation that does merging using a standalone xml editor (such as Oxygen), than what is required to accomplish the same
    using the LiveCycle XSLT service.  How do you specify the URI of the XML document that is specified as an input in the xsl document() function. Your insight is appreciated.   Regards

    Hello Steve,
    I checked the reference that you cited (XSLT Transformation).   The reference omits discussing how to use xlst document() function within a stylesheet.  I think that probably means that feature of xslt technology is not directly available through LiveCycle.  When I find a workaround, I'll post an update...for the user community that might encounter the same issue.  Thank you for your response and insight.  Regards, jb1809

  • Does anyone know how to use the bcc functionality for apple mail while accessing it on the cloud from my PC?

    I am currently away from my MAC and want to send an email through apple mail with the bcc functionality.  I am using the cloud to get to my mail, however, I can't figure out how to use the BCC functionality, please help.  Thanks!

    Open your mail,
    lower left corner click on settings,
    go to composing and check BCC, save and your done

  • How to Use the language function for assignment and validation

    Hi All,
    If anyone can explain me in details with example ,how to use the language function for assignments and validations?
    Thanks
    Arnab

    Hi Arnab,
    The expression is checked only for the current MDM session.
    If u login with the ABC language it will always show the ABC language no matter how many times u execute it.
    Try connecting to the DM with the XYZ language.
    It should go to the if part rather than else.
    Hope it helps.
    Thanks,
    Minaz

  • How to use oracle fusion middleware for integration project ?

    hi all,
    in my projects, customer (a bank) already has many applications (bankend & frontend) that are complicatedly connected. I intend to use oracle fusion middleware to integrate all applications and make adding new applications in the future easier. I have worked through documents in the oracle website but I still have no idea how to use oracle fusion middleware to address the requirement, besides oracle fusion middleware includes a bundle of applications I don't know which one I would need.
    could anyone give me some instructions ? appreciate your help.
    thank very much,

    Hi,
    For this short description of environment, could be ODI is a incredible tool to help you...
    Take a look into my blog that has a lot of concepts and "how to do" instructions.... http://odiexperts.com
    However to try help you, what are the used technologies?
    Where are you from?
    Cezar Santos
    http://odiexperts.com

  • How to use Oracle partitioning with JPA @OneToOne reference?

    Hi!
    A little bit late in the project we have realized that we need to use Oracle partitioning both for performance and admin of the data. (Partitioning by range (month) and after a year we will move the oldest month of data to an archive db)
    We have an object model with an main/root entity "Trans" with @OneToMany and @OneToOne relationships.
    How do we use Oracle partitioning on the @OneToOne relationships?
    (We'd rather not change the model as we already have millions of rows in the db.)
    On the main entity "Trans" we use: partition by range (month) on a date column.
    And on all @OneToMany we use: partition by reference (as they have a primary-foreign key relationship).
    But for the @OneToOne key for the referenced object, the key is placed in the main/source object as the example below:
    @Entity
    public class Employee {
    @Id
    @Column(name="EMP_ID")
    private long id;
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="ADDRESS_ID")
    private Address address;
    EMPLOYEE (table)
    EMP_ID FIRSTNAME LASTNAME SALARY ADDRESS_ID
    1 Bob Way 50000 6
    2 Sarah Smith 60000 7
    ADDRESS (table)
    ADDRESS_ID STREET CITY PROVINCE COUNTRY P_CODE
    6 17 Bank St Ottawa ON Canada K2H7Z5
    7 22 Main St Toronto ON Canada     L5H2D5
    From the Oracle documentation: "Reference partitioning allows the partitioning of two tables related to one another by referential constraints. The partitioning key is resolved through an existing parent-child relationship, enforced by enabled and active primary key and foreign key constraints."
    How can we use "partition by reference" on @OneToOne relationsships or are there other solutions?
    Thanks for any advice.
    /Mats

    Crospost! How to use Oracle partitioning with JPA @OneToOne reference?

  • How to use the CMS functionality in Sun Portal Server 7.2

    Hi All,
    How to use the CMS functionality using the ccd.war(Portlet) which is available in the library as i could add it to my channel but not able to show the functionality as it is showing the error msg "You are currently not logged in. Please login." should I create userid and there respective roles inorder to use the CMS functionality.
    Has any one used this as I could this in glass fish server.
    Any Input is appreciated.
    Thanks & regards
    Srikanth

    Have a look at the "*Roles*" section of the portal server 7.2 content management system guide
    http://docs.sun.com/source/820-4275/index.html . You can also look at [project mirage|https://mirage.dev.java.net] for some screencasts
    Alternatively,
    1. ccd.war has 3 portlets in it:
    (a) custom content definition portlet
    (b) custom content portlet
    (c) workflow portlet
    2. Inorder to work with these portlets, user needs to be in anyone of the below roles:
    (a)Consumer (b) Editor (c) Approver (d) Administrator (e) Submitter (f) Contributor (g) Publisher
    3. By default ccd.war gets deployed using a default roles file (/var/opt/SUNWportal/tmp/ccd.roles.properties)
    Note: In windows, you may not find this file
    4. Access the portlets as a user in any of the role mentioned in the ccd.roles.properties
    (OR)
    you can use a new roles file which has mapping to your custom roles. For this , undeploy existing ccd.war and deploy again with a new roles.properties file
    Hope this helps!

  • How to use the divide() function in bpel

    Hi All,
    How to use the divide() function in bpel.
    pls can u give the one sample example

    2 div 4
    Eg;
    <assign name="Assign_1">
    <copy>
    <from expression="2 div 4"/>
    <to variable="outputVariable" part="payload"
    query="/client:testProcessResponse/client:result"/>
    </copy>
    </assign>
    --Prasanna                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to use query-database() function in transformation?

    Hi All,
    How to use query-database() function in transformation?
    It is giving four fields but if i write select query in sqlquery field it is saying select node is not found....
    plz help me out
    Regards
    Pavankumar
    Edited by: [email protected] on Jul 29, 2009 2:49 AM

    Hi,
    To answer your query:-
    http://abhishek-soablog.blogspot.com/2008/08/orclquery-database.html
    Cheers,
    Abhi...

  • How to use Xerces to validate an XML file against a DTD

    Hi, can anybody tell me how to use Xerces to validate an XML file against a DTD. its urgent. post some sample code. it would be helpful for my project. isupposed to use SAX parser(Xerces)
    Thanx in advance

    Come on, I googled "xerces validate" and the first link is the Xerces FAQ:
    http://xerces.apache.org/xerces-j/faq-general.html
    And of course "how to validate" is a Xerces FAQ. Help yourself by doing a little research instead of waiting for other people.

  • How to use the set functions effectively in webi ,please let me know with detail

    how to use the set functions effectively in webi ,please let me know with detail

    Hi,
    we use use set functions on heirarchies with aggregate functions mostly .
    If you include member_set, Min returns the minimum value of the aggregated data for all members in the member set.
    Member_set can include multiple sets separated by semicolons (;).
    The list of member sets must be enclosed in {}.
    If the member set expression does not specify a precise member or node, the hierarchy referenced must be present in the table, then the member set expression references the current member in the hierarchy in the table. If the hierarchy is not in the table, the function returns the message #MULTIVALUE.
    Eg .
    1)     Ancestor
    =Sum([YTD] ; {Ancestor([Test Hierarchy];2)})
    2)     IsLeaf
    =[Test Hierarchy].IsLeaf
    You can use this function when you want to show your Measure only at lower level .
    3)     .Depth
    =[Test Hierarchy].Depth
    This is also function used with hierarchy to find Level of Members .
    Follow this link for PDF reference .
    Page 147
    https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&ved=0CDIQFjAB&url=https%3A%2F%2Fhelp.sap.com%2Fbusinessobject%2Fproduct_guides%2Fboexir4%2Fen%2Fxi4sp5_ffc_en.pdf&ei=nBAUU-iUM4WWrAeMuoCoDg&usg=AFQjCNHakXsEjd_yUk2y3lVdibf3PXpEOA&bvm=bv.61965928,d.bmk
    search on SCN this question was discussed before also one those links .
    http://scn.sap.com/thread/3183380
    Hope this will help you .

  • How to use Round off function in TAX Formula

    Dear All,
             I have to do Round off in the Tax Formula. Hence I was suggested by the SAP Forum Team to use Round off function in the Tax Formulae.
             But sir I don't know how to use Round off function in the Tax Formulae.
            For Eg. BaseAmt = Total
                        TaxAmt = BaseAmt * Rate
               Now within this Eg. How will i use the Round off function and where i will use it.
               Please guide me with example.
      Regards
    Hitesh Parsawala

    Hi Hitesh,
    you can do like this
    Cess_ST_TaxAmt=Round(Cess_ST_BaseAmt*Cess_ST_Rate,0)
    where you can introduce rounding function by choosing from dropdown available in Operation and by click on Insert.
    It will post following in formulla window
    Round (Number, Decimals as Number)
    where in parameter you have to give 1.Number-which is to be round and 2.Decimals as Number-as per your requirement like by 2 decimal or 0 decimal
    If required give me call,
    BR
    Samir Gandhi

  • How to use Spell-check functionality for textbox (like Orkut, gtalk)

    How to use Spell-check functionality for tex Hello Friends,
    I am working on a JSP application. I wanted to add Spell check for text box like we have here, when we post a message. It automatically shows red line under the word, when ever spelling is wrong. Please tell me how I can do this. If possible, the code too.
    Thanks.

    I believe the spell checking you see here, or on any other site, is the spell checking built into Firefox. At least that's what I see. Are you using Firefox?

Maybe you are looking for

  • Error while invoking decision service

    Hi, I have created a decide activity to invoke decision service partner link, then I have created copy operation assignments between fact types in my business rule set and BPEL variables. Now while running the BPEL process, I am getting the following

  • [SOLVED] Black screen when starting GNOME via GDM

    Hey guys, I'm a bit of a Linux newb, so apologies in advance for any stupidity on my part. I've just installed Arch in VirtualBox by following the beginner's guide, plus sudo, and now I'm trying to set up GNOME. I've installed the following packages,

  • How do i install adobe reader without installing products from google.

    i dont like google, i dont like a bunch of worthless taskbars crowding my browser. so how do i install adobe reader without installing google products when you dont even give me the chance to say i dont want them? It is unethical to force onto people

  • My Photoshop has stopped working?

    I recently upgraded my Macbook Pro with 2,2 GHz Intel Core i7 to the new OS Yosemite 10.10. Next thing, Photoshop stops working. I have a Creative Suite CS5.1 with Illustrator, Indesign and Photoshop. Now InDesign and Illustrator still works fine...

  • SetCurrentRowWithKey is not working for me

    I am very new to JDeveloper and attempting to do what seems like a very simple forward between pages. I have a Data Page that has Employee Roster information. I want to forward to a new page that has detailed information from an employee. I am using