Column XMLTYPE to select a SEPARATE attribute increasing fom and...

Hello
I spent all day to find the solution without success. PLEAS HELP!
The problem:
1. I have table xmlType column in this column is the following xml code:
< revision >
< product id = 1 >
< screws >
< img id = 1 / >
< / screws >
< screws >
< img id = 2 / >
< / screws >
< / product >
< product id = 2 >
< screws >
< img id = 1 / >
< / screws >
< / product >
< / revision >

I have to select SEPARATE img ID and then select / join their form table relational (id (number), pic (blob)) img

I can't find the solution to select the separate XML attribute values.

I tried this:


Select extract (c.xml, ' review/product/screw/img [not(@id=preceding-sibling::img/@id)] / @id') table c;

Hello

What is your version of the database?

Recent versions, you can:

SQL> create table test_xml (
  2   xml_data xmltype
  3  );

Table created

SQL>
SQL> insert into test_xml (xml_data)
  2  values(xmltype('
  3  
  4  
  5  
  6  
  7  
  8  
  9  
 10  
 11  
 12  
 13  
 14  
 15  
 16  ')
 17  );

1 row inserted

SQL>
SQL> select distinct x.img_id
  2  from test_xml t
  3     , xmltable(
  4        'revision/product/screw/img'
  5        passing t.xml_data
  6        columns img_id number path '@id'
  7       ) x
  8  ;

    IMG_ID
----------
         1
         2

SQL>
SQL> select x.img_id
  2  from test_xml t
  3     , xmltable(
  4        'for $i in distinct-values(revision/product/screw/img/@id)
  5         return $i'
  6        passing t.xml_data
  7        columns img_id number path '.'
  8       ) x
  9  ;

    IMG_ID
----------
         1
         2
 

Tags: Database

Similar Questions

  • Turn off/on a tabular Form attribute depending on the value selected in another attribute

    Dear Experts,

    I have

    1. an attribute in the form that is a select statement list containing 2 static values:

      • Family
      • Only

    and I have

    2 another attribute of tabular presentation that is display text (escape special characters, does not save the State), this attribute is also a link to another page.

    My requirement is when I select the family of another select list this attribute must be enabled and when I select one it should be disabled.

    Kindly help out me experts!

    Thank you and best regards,

    Madonna

    Hey Madonna,

    Please take a look at your page. I added a dynamic action that can be triggered by a change in the Type 'accompany' - selection list. dynamic action to display or hide the link 'Add family' according to the value of the selection list. the code of the dynamic action is as follows:

    $('.myClass').each (function () {}

    If ($(this).) Val() == 'Family') {}

    $(this) .parent () .parent ().find('.open_modal').show)

    } else {}

    $(this) .parent () .parent ().find('.open_modal').hide)

    }

    })

    where 'myClass' is the class that gave you to the selection list, and the "open_modal" is the class that gave you for the link.

    I used a show and hide because you cannot disable a link.

    I would like to know if that's what you had in mind.

    Kind regards

    Vincent

  • Update a column with randomly selected values

    Hello

    We have a chart of accounts that represents mainly the brands & channels. an example is shown below.

    account_ID chain_id brand_id service

    1 11 NULL NULL

    1 12 NULL NULL

    2 11 NULL NULL

    Here, I want to update the chain_id & brand_id which are currently ZERO in order to make all the eligible ranks for further processing. There is another table (say chain_brand) that maintains the relationship between chain_id and brand_id. a chain_id can have several brand_ids

    for example, chain_id brand_id

    101 2011

    101 2012

    102 2020

    Now I need a script that could randomly choose the values in the chain_brand table, and update the table accountable. condition is that these values must be unique for an argument account_id

    EG.,.

    account_ID chain_id brand_id service

    1 101 2011 11

    1 101 2011 12

    2 102 2020 11

    so each account can be attached to a single chain_id and a brand_id.

    Please suggest how this can be achieved.

    TIA.

    There is probably a pure sql solution far superior to mine... but in pl/sql

    Start

    for c in (select account_id, separate accounts)

    loop

    Update accounts

    package (chain_id, brand_id) = (select chain_id, brand_id

    from (select *)

    of chain_brands

    order of dbms_random.value)

    where rownum = 1)

    where account_id = c.account_id;

    end loop;

    end;

  • Apex error - maximum 100 columns can be selected

    Greetings!

    Version:
    Oracle 11.2
    Apex 4.1

    I have a classic dynamic report that brings back the result through a function. The result of the report presents data by week after your chosen dates. When the report has more than 100 columns, I get the error: "a maximum of 100 columns can be selected. Is there a way to avoid the 100 column limit in the report? Also is it possible to export the report to CSV file directly without getting this error in the report page?

    We intend to move to 4.2. This limit has been set to 4.2?

    Thank you
    SS

    code78 wrote:
    Greetings!

    Version:
    Oracle 11.2
    Apex 4.1

    I have a classic dynamic report that brings back the result through a function. The result of the report presents data by week after your chosen dates. When the report has more than 100 columns, I get the error: "a maximum of 100 columns can be selected. Is there a way to avoid the 100 column limit in the report? Also is it possible to export the report to CSV file directly without getting this error in the report page?

    Change your region report > under region Source > enter a number which corresponds to your need for maximum number of columns in the generic report

    You can create a custom procedure to generate data in csv format and print to the browser.

  • How to remove the name of the column in the select clause

    Hello guys,.

    I want to just delete a column name in the select clause. Because I don't want to write all the names of columns. I hope I am.

    In other words, I want the following.
    Select   * - unwanted_column  from table;
    
    instead of this 
    
    Select col1, col2, col3, col4, ........ col 10000 from table;

    Hello

    There is nothing in SQL, which means "all columns * except *...» ». As others have said, the only way to achieve these results in SQL is to list all the columns you want.

    Your front end may have a feature that allows you to hide a specific column. For example, in SQL * Plus, you can use COLUMN... NOPRINT , like this:

    COLUMN      dname     NOPRINT
    
    SELECT       *
    FROM       scott.dept
    ORDER BY  dname
    ;
    

    Output:

    `   DEPTNO LOC
    ---------- -------------
            10 NEW YORK
            40 BOSTON
            20 DALLAS
            30 CHICAGO
    

    There is a column called dname in the scott.dept table; the query above uses actually. But, because of the order of the COLUMN, SQL * Plus will not display this column.

    Published by: Frank Kulash on February 26, 2013 10:10
    Example of scott.dept has changed.

  • Value of the item as column name to select

    Hello

    I have a problem with the selection of the columns in the query using elements. For example: I have a request:
    Select column_a table; or select table column_b;

    and I want to do something like this:
    n ' any item where I choose the column name
    -query: select column_from_item from the tale of

    Is this possible?
    My version of the apex: 4.0.2.00.07
    My version of db oracle: oracle 11g

    Hello

    Create a report... type... as a function returning the SQL statement...

    and then you source should be something like

    declare
       my_sql_statement varchar2(1000);
    begin
       my_sql_statement := 'select ' || :p1_x || ' from table';
       return my_sql_statement;
    end;
    

    Kind regards
    Shijesh

  • Copy layers in the selection to separate the layer?

    Y at - it a keyboard shortcut that takes all of the layers that are inside a selection and copy in a new layer flattened?

    UPD: you can also select the layers by pressing shift and click on layers required by the Pan tool. I often do this, but instead of merge, I group layers to the folder (Ctlr-G)

  • have a column that has values separated by commas... and I'm s

    Have a column that has values separated by commas... and I'm trying to separate.
    I am trying to create a stored procedure... The 11g xe version. apex .and version 4...
    Here is the part of the code... I can't do a procedure. causes my intervention consist with the clause...

    create or replace procedure ins_adv_invoice
    (mmagazine_no number, madvtno number, missueno number, varchar2, varchar2, varchar2 msalesman_code mpagenumber msection)
    is

    cursor cx is with testa as
    (select name of the advertiser pagenumber)
    Select regexp_substr (pagenumber, ' [^,] +', 1, rownum) result
    the advertiser
    connect by level < = length (regexp_replace (pagenumber, ' [^,] + "")) + 1
    where advt_no = madvtno;


    Start
    for xxx CX
    loop
    insert into adv_invoice (magazine_no, advtno, adissue, section, opinion, salesman_code)
    values (mmagazine_no, madvtno, missueno, msection, xxx.result, msalesman_code);

    end loop;

    end;


    But when I run the present... it creates no procedure. . I receive he following error...
    LINE/COL ERROR
    -------- ----------------------------------------------------
    5/14 PL/SQL: statement ignored
    9/69 PL/SQL: ORA-00933: SQL not correctly completed command
    SQL >
    Still not able to understand... If anyone can help...
    Thank you

    Change the query to swap the last two lines:

    ...
    cursor cx is with testa as
    (select pagenumber name from advertiser)
    select regexp_substr(pagenumber, '[^,]+', 1, rownum) result
    from advertiser
    where advt_no = madvtno
    connect by level <= length(regexp_replace(pagenumber, '[^,]+')) + 1;
    ...
    
  • How can I select the first date (at least) and the corresponding date of two different tables source?

    I have 2 tables, INVOICE and INVOICE_REFNUM similar to below. I'm writing a query that withdrawing the first date (less) for a single record remaining the two tables. Each table records the receipt of invoices, but according to the source of the received invoice some may reside in INVOICE_REFNUM and others the INVOICE table. I also use DECODE on the topic of INVOICE_SOURCE, when the date less is taken from the INVOICE table that contains that field, so if the date is in the field INVOICE_REFNUM DECODE is not necessary. Example:

    INVOICE (table)

    INVOICE_GID INVOICE_SOURCE INSERT_DATE

    ABC. AVRT123 I HAVE 11/03/2012-15:49:32

    ABC. CNWY234 G 12/03/2012 14:07:30

    ABC. UPGF678 M 15/03/2012 20:21:54

    INVOICE_REFNUM (table)

    INVOICE_GID INVOICE_REFNUM_QUAL INVOICE_REFNUM_VALUE INSERT_DATE

    ABC. AVRT123 SOURCE ACS 11/03/2012 14:49:32

    ABC. CNWY234 SOURCE CSA 12/03/2012 13:07:30

    ABC. UPGF678 SOURCE ACS 15/03/2012 21:21:54

    My decode statement is: DECODE ("INVOICE_SOURCE, 'I', 'IDE', 'G', ' Auto-Pay", ', 'Manual')

    If I were to write a query on these two tables, the output will resemble the following:

    INVOICE_GID INVOICE_SOURCE INSERT_DATE

    ABC. AVRT123 ACS 11/03/2012 14:49:32

    ABC. CNWY234 ACS 12/03/2012 13:07:30

    ABC. UPGF678 Manual 15/03/2012 20:21:54

    I worked on it for 2 days, and I was able to pull a date by using the following SQL code, but cannot determine how to extract the corresponding source:

    SELECT THE LEAST (GLOGOWNER. INVOICE_REFNUM. INSERT_DATE, GLOGOWNER. THE INVOICE. INSERT_DATE) AS 'DATE OF THE INVOICE.

    GLOGOWNER. THE INVOICE. INVOICE_GID,

    DECODE (GLOGOWNER. THE INVOICE. INVOICE_SOURCE, 'I', 'IDE', 'G', 'Auto-Pay', ', 'Manual').

    GLOGOWNER. INVOICE_REFNUM. INVOICE_REFNUM_VALUE

    OF GLOGOWNER. INVOICE

    LEFT JOIN GLOGOWNER. INVOICE_REFNUM

    ON GLOGOWNER. THE INVOICE. INVOICE_GID = GLOGOWNER. INVOICE_REFNUM. INVOICE_GID

    WHERE GLOGOWNER. INVOICE_REFNUM. INVOICE_REFNUM_VALUE = "ACS."

    AND GLOGOWNER. INVOICE_REFNUM. INVOICE_REFNUM_QUAL_GID = 'SOURCE '.

    AND GLOGOWNER. THE INVOICE. INVOICE_TYPE = 'I '.

    ORDER OF GLOGOWNER. THE INVOICE. INVOICE_GID

    Any help is greatly appreciated!

    Best regards

    -Adam

    Hello

    Is that what you want?

    SELECT i.invoice_gid

    CASE

    WHEN ir.insert_date<= i.insert_date ="" then ="">

    WHEN i.invoice_souce = 'I' and THEN 'EDI '.

    WHEN i.invoice_souce = 'G' THEN 'debit '.

    WHEN i.invoice_souce = am' THEN 'manual '.

    END AS invoice_source

    , The LEAST (i.insert_date, ir.insert_date) AS insert_date

    I have the Bill OF

    JOIN invoice_refnum ON i.invoice_gid = ir.invoice_gid ir

    WHERE ir.invoice_refnum_value = 'ACS '.

    AND ir.invoice_refnum_qual_gid = 'SOURCE '.

    AND i.invoice_type = 'I '.

    ORDER BY i.invoice_gid

    ;

    There is no reason to do an outer join if you only want the lines with specific values anyway.

    What happens if the 2 tables have exactly the same invoice_date?  The query above takes the invoice_source of invoice_refnum in this case, but that can easily be changed.

    Or the other of the insert_dates can be NULL?

    I hope that answers your question.

    Otherwise, thank you post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also after the results you want from these data (otherwise what you have already posted).

    Explain, using specific examples, how you get these results from these data.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002#9362002

  • Urgent - how to separate incorrect load records and put it in a separate table

    We won't be a requirement in ODI 11 g of the customer each time a wrong record execution flow shud is met rather separate shud of those records in a table of errors as well as at the end of the charge of the management of errors we shud be left with all the documents (with the exception of incorrect records) in the target table and these records incorrect shud be there in a separate table of error.
    The definition of the incorrect records may include the size of a column or data type incompatible between the source table and target. How to implement this strategy in ODI of error handling, or is it one out of the box solution that we can leverage it please help.

    Thank you and best regards,
    SBV

    Published by: user13133733 on December 23, 2011 04:45

    Hi, SBV,.

    Please find my answers below,

    I tried the steps suggested, however I have some doubts:
    1. what all data exceptions (for example, violation of constraint primary key etc.) are dealt with in this mechanism?

    Yes, you can manage PK, FK, check violations of constraints etc. with CKM.

    2. If there is a difference in size between the source and target table column it will work? (I know because I tried it and it will give error before completing the I$ table, because I$ is created according to the source).

    You're right column size incompatibilities will not be captured under the property default CKM.

    Also, I get an error in the creation of the SNP_CHECK_TAB step. In my case, ODI's by default making a query like "create table. SNP_CHECK_TAB", now this period (.) before SNP_CHECK_TAB is what makes an invalid table name and that is why this step is a warning (not an error), but to the next step (delete previous checksum) is to launch a mistake because this step is also looking at. Table SNP_CHECK_TAB who's not here.

    Please help me here the whole issue. I don't know why he does this default query I freshly impoted the CKM Oracle and used.

    It's coz there is no physical schema by DEFAULT not defined on your target data server.

    Open Manager, topology-> Phy architecture-> -> -> develop, open your physical schema and check DEAFULT.

    Thank you
    Guru

  • With the help of the XML attributes in itemRenderer and labelFunction

    Hello!

    I searched for hours and read the Devguide but always impossible to find the solution to my problem.
    I have a xml returned from php like this:
    < files >
    < record id = "1" name = "name_1" type = "0" / >
    < record id = "2" name = "name_2" type = "0" / >
    < record id = "3" name = "name_3" type = "1 / >"
    < / documents >

    I can bind the result returned from the HTTPService to a data grid:

    < mx:DataGrid dataProvider = "{ret_XML.record}" width = "500" number of rows = "20" editable = "false" id = "dg" > "
    < mx:columns >
    <!-NEXT WORK! ->
    "< mx:DataGridColumn headerText ="Name" dataField="@name " width ="300"/ >
    <!- LABELFUNC don't DO NOT WORK IN LINE NEXT->
    "< headerText ="Type"dataField="@type mx:DataGridColumn " labelFunction ="labelFunc">
    < / mx:DataGridColumn >
    "< headerText ="Id"mx:DataGridColumn dataField="@id " editable ="false">
    < mx:itemRenderer >
    < mx:Component >
    <!-LINE FOLLOWING IS don't DO NOT WORK! ->
    "{< mx:Button label="{data.@id} '/ >
    < / mx:Component >
    < / mx:itemRenderer >
    < / mx:DataGridColumn >
    < / mx:columns >
    < / mx:DataGrid >

    and I have a labelFunction like this:

    private void labelFunc(item:Object,_column:DataGridColumn):String {}
    return "Type:"+ item.@type; "
    }

    So, my problem is that when I bind the column to an XML attribute, it works fine but when I try to link it to an itemRenderer or use it in a function, it does not work. I'm trying for hours now, but just can't make it work.
    I tried:
    "{< mx:Button label="{data.@id} '/ >
    < mx:Button label = "{data. () @id)} »/ >
    "{< mx:Button label="{@data.id} '/ >

    and perhaps others but no luck...
    Please someone help me with this one!

    Ty:
    [Pig]

    Problem solved!

    Well, post it on the forum after I solved my problem as follows:

    So in itemRenderer just use data.attribute () with the desired XML attribute name

    And in the labelFunction:

    private void labelFunc(item:Object,_column:DataGridColumn):String {}
    return "Type:"+ item.attribute ('type'); '.
    }
    Even with itemRenderer but rather data use () item.attribute

    I hope that this is the 'official' solution too...

    [Pig]

  • Select multiple tabs using the keyboard and mouse

    In short, I used to be able to select several byt tabs, one selected, hold down the Ctrl + Shift and then clicking on the last tab, I want to be added to the selection.
    The feature seems to have disappeared, is it possible to get it back?

    Hi 1031982!

    You use the Add on Multiple Tab Handler? If so, it seems, is not yet fully compatible with the latest version of Firefox (you can check out some of the comments here on the addons page: https://addons.mozilla.org/en-US/firefox/addon/multiple-tab-handler/ ).

  • At the opening of the various programs I get the error message 'extended attributes are incompatible' and "Consent UI has stopped working" in windows vista.

    Original title: extended attributes

    I started getting the following errors with various programs "extended attributes are incompatible" and "Consent UI has stopped working". I tried to do a system restore but get error inconsistent attributes for 'rstrui.exe '. I also had the message to ShellExecuteEX.exe when you try to install an application and even trying to download the Windows 7 Upgrade advisor. Just to check, I tried to run msconfig from the start and even gives me the message attributes. I am running Vista Home Premium with Service Pack 2 installed. Advice please. Thank you, Roger P

    Hi Roger P.

    ·         When the issue started?

    ·         Remember to make any hardware or software comes to the computer before this problem?

    ·         What antivirus application is installed on your computer?

    Method 1:

    You can try to run a SFC scan and check.

    This problem may occur if a system file is missing or damaged.

    You can refer to the method-the System File Checker tool in the following article:

    How to use the System File Checker tool to fix the system files missing or corrupted on Windows Vista or Windows 7

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

    I suggest you to follow these steps and check if that helps.

    Methoad 2: try to run the windows recovery option system restore.

    What are the system recovery options in Windows Vista?

    http://Windows.Microsoft.com/en-us/Windows-Vista/what-are-the-system-recovery-options-in-Windows-Vista

    It could be useful!

  • BGP announcement: How do I remove the attributes "next hop" and "metrics" inherited from OSPF?

    Hello

    I use a router THAT WAN Cisco ASR1001 connected via BGP AS65075 with our ISP.

    This router is connected through OSPF with our Cisco 7206VXR/NPE-G2 firewall.

    Topology:

    ISP <- bgp="" -="">RT 1001 <- ospf="" -="">FW 7206 <->LAN

    On the WAN router, static routes are set to null0 to always announce our class C networks.

    Route IP 192.168.10.0 255.255.255.0 Null0 250

    ...

    Network guidelines are placed in our BGP configuration:

    router bgp 65075

    The log-neighbor BGP-changes

    neighbor EBGP-PEER-IPv4-peer group

    EBGP-PEER-IPv4 neighbor fall-over bfd

    neighbour 192.168.88.138 distance - as 65200

    192.168.88.138 a neighbor EBGP peers PEERS-IPv4

    192.168.88.138 ISP IPv4 neighbor description

    next password 192.168.88.138 7 unknown

    !

    ipv4 address family

    ...

    network 192.168.10.0

    ...

    a neighbor EBGP-PEER-IPv4 soft-reconfiguration inbound

    EBGP-PEER-IPv4 neighbor distribute-list prefix-v4 on

    an EBGP-PEER-IPv4 neighbor prefix-maximum 100

    neighbor EBGP-PEER-IPv4-1 filter list out

    neighbor 192.168.88.138 activate

    neighbor 192.168.88.138 filter-list 2

    output-address-family

    A part of these networs are also learned through OSPF. If these routes are present in the routing table:

    RT-01 #sh ro ip 192.168.10.0

    Routing for 192.168.10.0/24 entry

    Known via "ospf 1", distance 110, metric 20, type extern 2, metric 1 forward

    Published by bgp 65075

    Last update to 192.168.0.79 on Port - channel1.28, 7w0d there is

    Routing descriptor blocks:

    * 192.168.0.79, from 192.168.0.71, 7w0d there is, through Port - channel1.28

    See metric: 20, number of share of traffic is 1

    Because these roads are active in the rounting table. Announcing BGP based on his and attributes "next hop" and "metric" are inherited from OSPF:

    RT-01 #sh ip bgp neighbors 192.168.88.138 announced-routes

    ...

    Network Next Hop path metrics LocPrf weight

    ...

    * > 192.168.10.0 192.168.0.79 20 32768 I

    ...

    Is it possible to remove the legacy of OSPF into BGP attributes?

    How to set the "next hop" to the value 0.0.0.0 and "metric" to 0?

    Thank you

    Best regards

    Jérôme

    Hello Berthier,

    NEXT_HOP is a hill & attribute mandatory path including the eBGP value is the IP address of the BGP peer (specified in the neighbor's remote control) where the router learns the prefix. Thus, your peers (eBGP) will still see the IP 192.168.88.138 in your BGP Next Hop as updates. I agree you the output of the command ' sh ip bgp neighbors 192.168.88.138 roads announced "can be confusing, but not worried about it.

    Metric 20 is cause of path must be acquired by OSPF. Copy in default atributte MED BGP metric. So I see that you have only a peer is very important change this value because MED is not transitive, if this value is not propagated by other ACE access your provider. Anyway, if you want to change, you must:

    1. create a list of prefixes with one or more prefixes that you want to "reset" the MED value:

    list of prefixes prefix-to-reset-MED seq 5 permit 192.168.10.0/24

    list of prefixes prefix-to-reset-MED seq 10 permit X.X.X

    2. create a roadmap

    allowed to reset - MED card route 5

    match of prefix-to-reset-MED IP prefix-list

    the metric value 0

    road map provided to zero-MED allowed 10

    !

    The last road map is necessary to ensure that the rest of the prefixes are sent.

    3. apply the road map

    a neighbor EBGP-PEER-IPv4-roadmap given to zero-MED on

    Concerning

  • to refine my question. The Lasso tool does not work.  When I select the content aware lasso shrinks and nothing changes.  Help please.

    to refine my question. The Lasso tool does not work.  When I select the content aware lasso shrinks and nothing changes.  Help please.

    A simple reset will often be the case if a tool becomes awkward. Go to this link, then select the lasso tool:

    Difficulty of tool

Maybe you are looking for

  • I use firefox and tried to access the list of favorites. no luck?

    Have always used Yahoo mail, but had to change browser for firefox as yahoo is no longer supported my IE9 for yahoo mail. I want to continue with email from yahoo that I like. Now I can get email yahoo thanks to firefox, which is great. I want to acc

  • is anyone having problems with the debenhams site when accessed from an iPad?

    I can't select sizes, etc. When I go to debenhams site from my iPad 2. In addition, items disappear from my basket once they have been added & new items disappear from the "saved" so box. I was wondering if anyone else may be faced with a similar pro

  • IPod displays "ok to disconnect message" but doesn't stop does not automatically or go to main menu / cannot load

    I recently connected my ipod on my car and the message display "do not disconnect". I accidentally unplugged ipod and when I reconnected it a new message "ok to disconnect". I never got my ipod to stop or go to the main menu. I tried to recharge and

  • Media on screen Volume control problem

    I'm unable to reduce or increase the volume on my screen when it comes to a media volume... Volume ring tones and notifications I can. Steps to reproduce: * Play a song or any games* Try to click the volume button that is on the side of the phone* vo

  • Download a cDAQ-9174?

    Hi newbie here. Just bought a cDaq-9174 equipped with a card of entry and exit. I'm a little excited to try the new unit out, but I can't seem to figure out how to download anything for her. I just want to try to shoot an entry and see an exit lights