Could someone explain what extractvalue, xmlsequence and extract is doing in the following query:
select
extractvalue(value(a),'Notebook/@Brand') As Brand
,extractvalue(value(a),'Notebook/@Model') As Model
from prod_xml_tab b,
table( xmlsequence( extract( demo_field,'Product/Notebook' ) ) ) a
where demo_field is not null;
I went through documentation and still don't get it, and need some basic explanation step by step. for example, what is actually EXTRACT returning for first and second row?
the code for table and data is as follows:
create table prod_xml_tab (demo_field xmltype);
insert into prod_xml_tab values('
<Product type="Laptop">
<Notebook Brand="HP" Model="Pavilion dv6-3132TX Notebook">
<Harddisk>640 GB</Harddisk>
<Processor>Intel Core i7</Processor>
<RAM>4 GB</RAM>
<Price>1189</Price>
<Display Type="LED" MonitorSize="15.6"/>
<Weight>4.14</Weight>
</Notebook>
<Notebook Brand="HP" Model="HP Pavilion dv6-3032TX Notebook">
<Harddisk>640 GB</Harddisk>
<Processor>Intel Core i7</Processor>
<RAM>6 GB</RAM>
<Price>1104</Price>
<Display Type="LED" MonitorSize="15.6"/>
<Weight>4.1</Weight>
</Notebook>
<Notebook Brand="HP" Model="Pavilion dv6-3079TX Notebook">
<Harddisk>500 GB</Harddisk>
<Processor>Intel Core i7</Processor>
<RAM>4 GB</RAM>
<Price>1099</Price>
<Display Type="LED" MonitorSize="15.6"/>
<Weight>4.14</Weight>
</Notebook>
</Product>');
insert into prod_xml_tab values('
<Product>
<Notebook Brand="Toshiba" Model="Satellite A660/07R 3D Notebook">
<Harddisk>640 GB</Harddisk>
<Processor>Intel Core i7</Processor>
<RAM>4 GB</RAM>
<Price>1444</Price>
<Display Type="LED" MonitorSize="15.6"/>
<Weight>4.88</Weight>
</Notebook>
</Product>');