How to extract data using the xml data type

Hello
I tried the following example using the xml data type, but not the desired output.
could you please correct the query in order to obtain the necessary
CREATE TABLE TEST.EMP_DETAIL
(
  EMPNO       NUMBER,
  ENAME       VARCHAR2(32 BYTE),
  EMPDETAILS  SYS.XMLTYPE
)
Insert into EMP_DETAIL
   (EMPNO, ENAME, EMPDETAILS)
 Values
   (7, 'Martin', XMLTYPE('<Dept>
  <Emp Empid="1">
    <EmpName>Kevin</EmpName>
    <Empno>50</Empno>
    <DOJ>20092008</DOJ>
    <Grade>E3</Grade>
    <Sal>3000</Sal>
  </Emp>
  <Emp Empid="2">
    <EmpName>Coster</EmpName>
    <Empno>60</Empno>
    <DOJ>01092008</DOJ>
    <Grade>E1</Grade>
    <Sal>1000</Sal>
  </Emp>
  <Emp Empid="3">
    <EmpName>Samuel</EmpName>
    <Empno>70</Empno>
    <DOJ>10052008</DOJ>
    <Grade>E2</Grade>
    <Sal>2530</Sal>
  </Emp>
  <Emp Empid="4">
    <EmpName>Dev</EmpName>
    <Empno>80</Empno>
    <DOJ>10032007</DOJ>
    <Grade>E2</Grade>
    <Sal>1200</Sal>
  </Emp>
</Dept>
'));
I need to get the record for Empid = '2'
Then tried the following query with no expected o/p
SELECT a.empno,a.ename,a.empdetails.extract('//Dept/Emp/EmpName/text()').getStringVal() AS "EmpNAME",
     a.empdetails.extract('//Dept/Emp/Empno/text()').getStringVal() AS "EMPNumber",
      a.empdetails.extract('//Dept/Emp/DOJ/text()').getStringVal() AS "DOJ",
      a.empdetails.extract('//Dept/Emp/Grade/text()').getStringVal() AS "Grade",
      a.empdetails.extract('//Dept/Emp/Sal/text()').getStringVal() AS "Salary",
      a.empdetails.extract('//Dept/Emp[@Empid="2"]').getStringVal() AS "ID",
      a.empdetails.extract('//Dept/Emp[EmpName="Coster"]').getStringVal() AS "CHK"
     FROM emp_detail a 
     where empno=7  
           AND a.empdetails.existsNode('//Dept/Emp[@Empid="2"]') =1
Thank you...

Karthick_Arp wrote:
I'm not very good at that... But if your XML code should not be more like this

SQL> Insert into EMP_DETAIL
2     (EMPNO, ENAME, EMPDETAILS)
3   Values
4     (7, 'Martin', XMLTYPE('
5    
6      1
7      Kevin
8      50
9      20092008
10      E3
11      3000
12    
.. cut ..

Why? It is perfectly valid to data as attributes rather than elements and also quite common for key values.

Tags: Database

Similar Questions

  • How to extract pages using the software adobe reader 11?

    Hello Webmasters,

    I want to extract pages pdf with adobe reader. I'm currently using the version 11. Could someone please advice on this?

    Thank you

    Srinath

    Adobe Reader has no such functionality; you will need Acrobat for that.

  • How to extract data using bluetooth other device...

    Hi all

    First, I describe my problem:

    I want an application that extract the xml data in ECG device using bluetooth after accessing this data make some calculation and send it to the server... I am able to serach all the device compatible bluetooth after that, I am also able to connect from the particular device... (Now I use bluetooth Simple device as phone, pc or anything which is Bluetooth)

    Now the problem is... After connection of the device, I want to go get a (for example an image or text document.) file of the device connected using my camera...

    can anyone know how to extract data or file to another device that is currently associated with my camera... using BlackBerry device...

    Please help me to overcome this problem...

    Currently, I am working with Blackberry.6

    As suggested, I would recommend you try the samples provided.

  • How to post JSON using the Oracle Data Service remains

    I use the regular (not NoSQL or something) oracle database with oracle rest data service. Now I need to post data / put wrote in the body of the request using some json/xml format, how to consume them using the rest data service, searching inside the express application?  important: using pl/sql block

    Also, I am on,

    Data service Oracle rest 3.0

    Oracle Application Express 4.2

    Post edited by: Jacynthe

    OK, I got the answer. At the express request, there is a link called body variable (: body in BLOB). but the BLOB data type. So, we have to convert that in other data, type what we in pl/sql. I've converted data type witch CLOB supports json.

  • How to extract data from SQL server in the FDM

    Hi Experts

    How to extract data from a SQL server HFM to another SQL Server using scripts for integration in FDQM?

    concerning

    Dev

    Could you clarify why you want to do this?

    If you try to synchronize two databases (apps) to have a backup or something running in a development environment, I suggest configuring replication between two databases. It would be much more effective to do it at the SQL Server level through the application of FDM, IMHO.

    Charles

  • How to extract data from a signed pdf that was sent to me.

    I can extract data from a PDF file that is not signed, but how to extract data from a signed PDF? Exporting data option does not work once it is signed. Specifically, I want to combine the data into a csv file, but a PDF signed does not to me.

    Hi evanb92625060,

    It is not possible to extract (using Acrobat |) Collection and management of the PDF to form data) data from a signed PDF form is that it locks all fields in the form.

    Kind regards
    Nicos

  • How to extract information from the ovf file from a file of eggs by programming?

    How to extract information from the ovf file from a file of eggs by programming?

    Hello

    Please provide details:

    -On what OS you are programming (Linux, Windows,...)?

    -What programming or scripting language do you use?

    An EGG file is just a tarball of hard, .ovf and .mf files. The .ovf file is always the first. For example, on a Unix like operating system, this should be easy.

    For Windows, there are several options available to manage programmatically the tarballs. See for example http://www.codeproject.com/Articles/470999/tarlib-Windows-TAR-Library.

    And the ovf itself file is in XML format. For handling XML files are libraries available for literally every OS and programming language.

    Google is your friend.

    Andreas

  • A report that will show how a user has used the secure area?

    Hello everyone.

    I need to view a generated in the report on the activities of the Member section to securezone.

    The ideas are greatly appreciated.

    I've tried selecting the protected area (in the areas of Secure), click on action -> View Secure area usage report

    But it just displays: no data available for the period selected. no matter how to set the filter of time.

    Best regards

    Jones

    It seems that it is a duplicate to your message in this thread: is there a report that will show you how a user has used the secure area? . I will follow on this issue on the same thread.

  • Hi, I want to know how to extract and save the text highlighted on Acrobat Reader.

    Hi, I want to know how to extract and save the text highlighted on Acrobat Reader.

    Hi Eli Marto,

    I'm sorry, but it is not possible to extract text from a PDF file using the player.

    It can be done using Adobe Acrobat.

    Ref: export the comments AND highlighted text?

    Kind regards

    Ana Maria

  • Center aligning images in table using the XML file

    Hello
    I use a flash file that uses an xml file to download a series of images one by one in a photo-gate.
    There are two different widths of images. The height is always the same. Is it possible to set up so that each image that calls file xml is center aligned as part of image.
    At the present time when using the xml file to load the image she always left aligns the image when he brings it in image even if you change the alignment to center align in the Panel align.
    Does anyone have a suggestion why this happens or how to fix it?
    Thanks for the help

    I did this quickly and did not test - but if it does not directly at the exit it might give you a starting point - or someone else can correct if there are errors. I'll check tomorrow - where I am its time to go to sleep...
    CHANGE the DETAILS: Just changed a few pieces of code I posted last night - I forgot to change the statement holder_mc.loadMovie in xml.onLoad Manager. I have not tested, but its along the lines of the approach I would use to solve your problem with resizing the image. Let me know how you go with it.

  • How can I print using the cover

    How can I print using the cover

    using the cover?  How is that? To be more specific, which is a software or hardware?

  • How to activate and use the built-in webcam

    built in webcam

    How to activate and use the built in webcam on my desktop Dell Inspiron 1?

    MikeViklund,

    Try to read...

    Use and troubleshooting of the Webcam Dell and Dell Webcam Central Software

    Rick

  • How do I stop using the product key in my PC, so I can use it in my laptop?

    A long time ago I had installed Windows Vista (original) on my PC at home. But now I m leaving in another city and I m just using my laptop. I received a message through the Windows Activation (¨The product key you typed is already use¨) and two options: buy a new online or type a different product key. I Don t want to buy anything and I Don t have a different product key. So, how can I stop using the product key in my PC (which i Don t use it!), so I can type in my laptop? Maybe uninstall Windows in my PC could solve the problem, but I Don t want to travel back home 7 hours for this! What can I do now?

    PS. : Sorry about my English, I m still learning!

    A long time ago I had installed Windows Vista (original) on my PC at home. But now I m leaving in another city and I m just using my laptop. I received a message through the Windows Activation (¨The product key you typed is already use¨) and two options: buy a new online or type a different product key. I Don t want to buy anything and I Don t have a different product key. So, how can I stop using the product key in my PC (which i Don t use it!), so I can type in my laptop? Maybe uninstall Windows in my PC could solve the problem, but I Don t want to travel back home 7 hours for this! What can I do now?

    PS. : Sorry about my English, I m still learning!

    Your English is very good.

    You simply need to activate Windows in the laptop by phone call at a command prompt, type slui 4.

    You * must * also to remove Windows from your desktop computer, but if it is to wait a few moments, it shouldn't be a problem.

  • How low-level format using the code debugging?

    original title: how to low-level format using the debug code? can someone give a code

    How low-level format using the code debugging? can someone give a code

    Hi microcontrol.

    ·          What is the number and the model of the hard disk that you use?

    Your question does contain all the required information necessary for us to help you. Please provide more relevant information to continue troubleshooting as a result.

    The Microsoft article below may help if you use a disk Western Digital or Seagate.

    Using DEBUG to start formatting

    http://support.Microsoft.com/kb/60089

    I hope this helps!

    Halima S - Microsoft technical support.

  • How do I export using the CC 2015 on DVD media encoder

    How do I export using the CC 2015 on DVD media encoder

    You will need to export mpeg2-DVD and then take it to a creation as a supplement program to create a DVD compatible file.

    If you have CC, you can download it here again CS6 (it comes with Premiere Pro CS6):

    How to find and install a previous Version of Adobe Apps in CC 2015 | Adobe Customer Care Team

Maybe you are looking for

  • Impossible to install an epson nx415 printer

    I just bought an epson nx415 all-in-one and cannot make it work with windows xp.  tried all the dysfunctions and nothing.  There seems to be some kind of conflict between the epson driver and windows driver.please help thanks

  • Dynamically add tabs QML from C++

    Hello world I have a simple TabbedPane defined in QML.  I am trying to reference the TabbedPane via C++ to dynamically add tabs.  Is this possible?  With my current setup, the application starts and crashes then with: Process 22253787 (MyTabsApplicat

  • Windows operating system licensing for virtual environments

    How will the license of windows 7 Os or no matter what Windows OS work when import us an iso image or snapshot of performance already windowsOS machine physical-to-virtual machine? (w.r.t. a cloud or virtualized environment?)

  • Unable to set new conection

    How to configure a connection new starter home... Thank you

  • ViewObject row is always zero

    HelloI want to get ViewObject Programatically to do AppModuleImp.java and use the following codeNotice of ViewObjectImpl = getVO_Pro1();int count = view.getRowCount ();System.out.println ("count:" + count);for (int i = 0; i < count; i ++) {}Line r =