Check the value of the attribute of a child node to xmltype data type.

Hello

I have a xml stored in the column with the data type as "XMLTYPE.
<?xml version="1.0" encoding="ISO-8859-1"?>
<Settings>
  <Setting Name="A1" Value="N"/>
  <Setting Name="A2" Value="N"/>
  <Setting Name="A3" Value="SOMEVALUE"/>
  <Setting Name="A4" Value="N"/>
  <Setting Name="A5" Value="Y"/>
  <Setting Name="A6" Value="N"/>
</Settings>
I don't want to loop in each child node. But want to know if the value of the A5 parameter is Y or N? Is there a way I can find it without making the child node extract "Setting" and then a loop of each node to find the value?

Kind regards

You specify your Oracle version then here are two options. If 10.2 or higher, use XMLTable, otherwise use the option of ExtractValue.

-- The WITH simply simulates your existing table that I do not have.
WITH fake_tab AS
(SELECT XMLTYPE('

  
  
  
  
  
  

') tab_col
  FROM dual)
-- For 10.2 and higher use this SELECT
SELECT a5
  FROM fake_tab,
       XMLTABLE('/Settings'
                PASSING fake_tab.tab_col
                COLUMNS
                a5   VARCHAR2(10)  PATH 'Setting[@Name="A5"]/@Value');

-- For 10.1 and before
SELECT ExtractValue(tab_col, '/Settings/Setting[@Name="A5"]/@Value')
  FROM fake_tab;

Tags: Oracle Development

Similar Questions

  • How to check the NUMA on ESXi host node

    Dear team,

    I have cisco ucs Server Blade configuration below b - 200 m3. I want to know how to check the NUMA on ESXi host node.

    RAM: 192

    Socket 2 (8 cores).

    concerning

    Mr. VMware

    Unfortunately, it seems THAT NUMA is disabled hardware wise. You can only activate it via the BIOS setting.

  • A question about the conservation of fields (hour, min, sec) time DATE type in the table on the changes of NLS_DATE_FORMAT

    Hello

    Oracle version: 12.1.0.1.0 - 64 bit

                      OS:   Fedora Core 17 X86_64

    My question is about the conservation of fields (hour, minute, second) time DATE type in the array on NLS_DATE_FORMAT changes.

    Take the following test case:

    SQL> create table tmptab(dateval date);
    
    Table created.
    
    SQL> alter session set nls_date_format = 'yyyy-mm-dd hh24:mi:ss';
    
    Session altered.
    
    SQL> insert into tmptab(dateval) values('2014-01-01 00:00:00');
    
    1 row created.
    
    SQL> insert into tmptab(dateval) values('2014-01-01 10:00:00');
    
    1 row created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> select * from tmptab;
    
    DATEVAL
    -------------------
    2014-01-01 00:00:00
    2014-01-01 10:00:00
    
    SQL> alter session set nls_date_format = 'yyyy';
    
    Session altered.
    
    SQL> select * from tmptab where dateval > '2014';
    
    no rows selected
    
    SQL>
    

    I don't understand why it returns nothing. The second test case above insert statement inserted a line with 10 as the value for the time of the DATE field column dateval.

    Accordingly, while comparing this with the literal '2014' (which based on the new value of NLS_DATE_FORMAT = "yyyy" is implicitly converted to DATE), shouldn't the above query returns the line 2014-01-01 10:00 ?

    I mean, I changed the NLS_DATE_FORMAT but data from time in the table fields are preserved and that's why they should normally be taken into account in the comparison of date.

    What I'm trying to say is that for me (Please correct me if I'm wrong), no matter what NLS_DATE_FORMAT configuration is the following test

    SQL> select * from tmptab where dateval > '2014';
    

    is the same thing that

    SQL> select * from tmptab where dateval > to_date('2014-01-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
    

    And because the line 2014-01-01 10: 00:00 in the tmptab table. The following test

    2014-01-01 10:00:00 > to_date('2014-01-01 00:00:00', 'yyyy-mm-dd hh24:mi:ss')
    

    evolves normally true (beucase of TIME = 10 on the left side of the test) and therefore this line must be returned which is not the case in the test above.

    You kindly could you tell me what I misunderstood?

    Thanks in advance,

    This is the price for the use of implicit conversions. Implicit DATE conversion rules are not as direct as it can be assumed. In your case, all you provide is year as date format. In this case date implicit conversion rules assumes that month in the current month, day 1 and time as 00:00:00.

    SQL > alter session set nls_date_format = "yyyy";

    Modified session.

    SQL > select to_char (to_date ('2014 "), ' mm/dd/yyyy hh24:mi:ss') twice;

    TO_CHAR (TO_DATE('20)
    -------------------
    01/08/2014-00:00:00

    SQL >

    So, when you start:

    Select * from tmptab where dateval > '2014 '.

    Oracle implicitly converts date using "YYYY", which translates as August 1, 2014 '2014'. That's why your quesry returns no rows.

    SY.

  • How to access the attribute of the Parent of a child node?

    Hello

    I'm trying to accomplish something simple here, by accessing the value of the attribute of the node parent to a value of the child. I have the date given here, but I'll try to find the name of the event to the date, the name of the event or the attribute parent date.

    I have the code here, as in the following, but I kept getting #1009 error term undefined in line with parent() inside. Could someone please guide me on how to solve this problem?

    Thanks in advance.

    Alice

    "alice_data" wrote in message
    News:gr2fkh$CRE$1@forums. Macromedia.com...
    > Hi,.
    >
    > I am trying to accomplish something simple here, by accessing the parent company
    > value of the attribute of the node to a value of the child. I have the date given here,
    > but I
    > trying to find the name of the event of the day, including the name of
    > the
    > event is the attribute of date parent.
    >
    > I have the code here, as in the following, but I kept getting term #1009
    > not
    > set the error on line with parent() inside. Could someone please guide
    > me on
    > How do I fix this?
    >
    > Thanks in advance.
    >
    > Alice
    >
    > Excerpt from Actionscript:
    >
    > var resultC:XMLList;
    > resultC = searchResult... Book.schedule_item.date;
    > var resultD:XMLList;
    >
    > / * The following two lines kept giving me some bad mistakes #1009
    >
    > / / resultD = resultC.parent () .@type;
    > / / trace ("It's D" + resultD + "\n");
    >
    > / * End of error
    >
    > var resultC_collection:XMLListCollection = new
    > XMLListCollection (resultC.*);
    >
    > //Debug goal, print the string the result selected XML
    > trace ("this is the result:" + resultC);
    >
    > XML:
    >
    >
    > 20/03/2009
    > 22/03/2009
    >

    I think your problem is that resultC is an XMLList. Go to the parent company, you
    necessary to arrive at a SINGLE element in the list. Even if it is a list that contains
    a single element, which is not the same as a single element.

    Try

    Note that I do not book in your xml, so I doubt that is correct
    resultC is searchResult.child('book') .child ('schedule_item').child('date');.

    resultD resultC = [0] .attribute () .parent ('type');

    Note that the syntax that you used will break if no element has not one
    child or the attribute corresponding to your request, so I used the more verbose syntax.

    HTH;

    Amy

  • 4.0.3 export the result of grid in xlsx for different data type

    Hello

    Using SQL Dev 4.0.3.16 build 16.84 principal.

    Windows 7

    Java 1.7u80

    Run the query, click with the right button on the result of the grid:

    When you export data in xlsx format, why the numbers data type has different type of font.

    -Number / digital-> dialogue

    n.jpg

    -date and varchar2-> Calibri

    v.jpgd.jpg

    Step to reproduce:

    1 run this query

    Select 100 n, '100', to_date (1 January 2015 ',' DD-MM-YYYY "") as d

    Double;

    2. right click on the grid - export

    3. choose the Format: excel 2003 + (xlsx)

    Thank you.

    Buntoro

    This is a known behavior. And I think that there is a feature request to the SQL Developer Exchange, like the export of dates date request and not as text.

    Concerning

    Marcus

  • Merge attribute parent to child nodes using XMLTable / XQuery.

    I have the following query from XMLtable, where I'm trying to transpose the parents attribute to all the children lines OR return the attribute parent:

    Select *.

    from XMLTable)

    ' for $i in/ROOT/POINT

    Returns the element r {}

    $i/.. @ALL,

    $i

    }'

    from XMLType)

    ' < ROOT ALL = "O" >

    < ELEMENT > 1 < / ITEM >

    < ELEMENT > 2 < / ITEM >

    (< / ROOT > ')

    columns

    "ALL' char (1) path"@ALL. "

    Entire path from POINT "ITEM.

    );

    | ALL THE | AGENDA |

    --------------

    | Y   | 1    |

    | Y   | 2    |

    It works fine, but it fails if I pass later...

    passing XMLTYPE (' < all THE ROOTS = 'Y' / > "")


    I want the following:


    | ALL THE | AGENDA |

    --------------

    | Y   |      |

    I tried to change the Xpath expression /ROOT/ITEM|/ROOT/[@ALL and not (ITEM)], but getting syntax errors.  Am I missing something obvious?

    I tried to change the Xpath expression /ROOT/ITEM|/ROOT/[@ALL and not (ITEM)], but getting syntax errors.  Am I missing something obvious?

    What mistakes?

    Most obvious I see is a supplement before slash after the second stage of the ROOT:

    / ROOT/ARTICLE | / ROOT/[@ALL and not (ITEM)]

    Personally, I do like this:

    Select *.

    from XMLTable)

    '(

    for $i in/ROOT/POINT

    Returns the element r {}

    $i/.. /@ALL

    $i

    }

    ) | ' / ROOT [not (ITEM)].

    from XMLType)

    '

    1

    2

    ')

    columns

    "ALL' char (1) path"@ALL. "

    Entire path from POINT "ITEM.

    );

    or using an axis forward and an outer join:

    Select x 1» "All THE", x 2. AGENDA

    from XMLTable ('/ ROOT')

    from XMLType ("")

    columns 'ALL' char (1) path '@ALL '.

    , ELEMENTS xmltype path "ITEM.

    ) x 1

    left outer join

    XMLTable ('/ POINT')

    by the way x 1. ELEMENTS

    whole columns ITEM path '. »

    ) x 2

    1 = 1

    ;

  • Is there a way to check the attributes of the user in the Apex?

    When you create a user from the Apex, there is an option of radio button under the account privileges, bearing the mention "user is a developer. Is there a way to make an object page apex condition if the currently logged-in user (app_user) is a developer? What is the syntax for the verification of an attribute of the user?

    Chris10263447 wrote:

    When you create a user from the Apex, there is an option of radio button under the account privileges, bearing the mention "user is a developer. Is there a way to make an object page apex condition if the currently logged-in user (app_user) is a developer? What is the syntax for the verification of an attribute of the user?

    Use of the apex_util.get_user_roles function of the API, or the APEX_WORKSPACE_APEX_USERS.IS_APPLICATION_DEVELOPER of the view column query.

  • Eager to check the use of my child on HIS computer...

    My husband has his own laptop.  We discovered that she was for access to sites appropriate and immediately put in place the security of the family.  To do this, I had to set up parental controls on my computer and add it as a child, before I could set up parental controls on HIS computer.  Now that I did that, when I try to access to his PC, he only give me info of its activity on MY computer - which is none, because it has its own.  How do I put in place so that reports its activities on HIS computer?   Any help you could give me would be greatly appreciated!  Thank you!!  :)

    You will not be able to see the report of the child, if your child is connecting to a different user account which was not established in respect of the security for the family. Check if it is the problem.

    Follow the articles below for more information.

    How can I get reports on how my child used the PC?

    Turn on parental controls for your child's account

    I hope this helps.

  • Laptop HP Stream - 11-d010wm: having to check the compatibility of a MicroSD card with my data flow specifications before buying the card

    A SanDisk Ultra 16 GB UHS-I/class 10 Micro SDHC memory is not compatible with a laptop HP of Stream - 11-d010wm (ENERGY STAR)?  I have a couple of Micro SD cards, but they are getting older and being not recognized when I put them in the card slot reader, so I guess that they are not compatible.  I'm looking to buy a new SD card, but not to run into the same problem, so want to check compatibility before you buy... any help would be appreciated.  Thank you.

    You can also consult the many Amazon comments and answered questions for the 11 waterways, as some say the real SD card they bought (although most seem to just mention 'micro SD' so I really think that everything you buy is going to work).  I can't explain why the 2 you have now are not unless they received a different kind of formatting.

    Ah wait however, this review has reported problems with the three different SanDisk class 10 cards, maybe you can search through the comments and find some that work.

  • Check the model of level 0 members and remove data

    Hi all

    I stuck everything by a script. Would appreciate any help.

    Here is the cost center hierarchy:

    -CC_NL

    -CC_NL_1

    -NL_10

    -NL_11

    -CC_NL_2

    -NL_20

    -NL_21

    -CC_NL_3

    -CC_NL_4

    --

    --

    --

    Now my requirement is:

    I have to check if Member of level 0 of CC_NL begins with CC_NL (i.e. CC_NL *), then delete this member of level 0 data. As in the hierarchy above CC_NL_1 and CC_NL_2 are not members of level 0 so no need to do anything other than CC_NL_3 and CC_NL_4 are members of level 0, so we need to delete the data present in it.

    I tried the above condition to the code below:

    FIX ("CC_NL")

    @MATCH ((@RELATIVE("CC_NL",0)), "CC_NL *")

    ENDFiX

    but it did not work as 'MATCH' fn require a member name and for that Member and its descendants, it will search the model. so above @RELATIVE("CC_NL",0) will not work because it will take members of level 0 and by definition Match fn does not work like that

    Appreciate pointers to solve the problem.

    Thank you

    How about you match and parent?

    Fix (@LEVMBRS(Market,0) AND @MATCH("Market","New*"))

    Concerning

    Celvin

  • How to limit the maximum children to a node that contains different types of node

    Hello

    I have the following XML:

    <categories>
        <category id="hsp">
            <cardUsage id="hsp.approvals">
                <tabUsage id="hsp.approvals.puListing"/>
                <tabUsage id="hsp.approvals.puDashboard"/>
            </cardUsage>
            <cardClusterUsage id="hsp.someCluster">
                <cardUsage id="hsp.someCluster.approvals"/>
            </cardClusterUsage>
        </category>
        <category  id="psb">
        </category>
        <category  id="pfp">
        </category>
        <category  id="cx">
        </category>
    </categories>
    
    
    

    I need to put a restriction on this category of node cannot have more than 16 children (nodes of cardUsage + cardClusterUsage nodes).

    The way I thought to achieve this, use a new use as a child of the category node. I could put on its use maxOccurs at 16. And then in use use the XS: Choice to choose between cardUsage and cardClusterUsage. And the maxOccurs 1.

    Please let me know if there is a better way to do it. Or if you see the flaws in my proposal.

    Thank you for your time in advance.

    Matt.

    The order of the child category matter?

    If this isn't the case, you can directly set maxOccurs on 16 in the xs: Choice:

  • The attributes defined for SelectCheckbox in the view object Failed

    Hello

    I expanded the view object of the table to filter the records and the table contains the selection box (no change has for this box). When I choose one of the records to help select the check box and go to an action, the error is coming as "Attribute defined for SelectCheckbox in the view object TeamTableVO failed" ... Is the error due to VO scope or any other reason...

    Help, please...

    Kind regards

    Praveen

    Hello..

    Check the following

    1. check if the value of any attribute is set, if yes remove

    2. check the attribute map

    3. set your columns can Yes

    4. check if its VO selected to interview

  • The attributes of the element list empty when adding attribute #FROM_ROLE to the message (Type CREATEPO element)

    I'm customizing item type CREATEPO adding a new notification with the corresponding message and I am facing a problem with the workflow designer (using the v2.6.3.5.0 Oracle workflow Builder).

    This notification must have a specific sender, which is already stored in a custom element attribute.

    According to the developer's Guide, I add a new message attribute with the internal name = "#FROM_ROLE" for the new custom message.

    I put all the remaining data, according to the instructions of the Manual: Type = role, source = send, full name and description = ' role', default = attribute Item type.

    But when I try to set the default value, the list is empty and I can't choose any attribute of the element.

    I tried to define a new message in other Types of items, such as REQAPPRV, and in this case, the list of attributes is displayed correctly.

    Any idea or solution?

    Thanks in advance,

    David

    I already solved the problem.

    So that the attributes of the element to appear as default values for the attribute Message #FROM_ROLE, they must also be of type role.

  • Error code: 80248009 (cannot install or check the updates)

    My computer is telling me that Windows cannot check the updates.

    0 x 80248009 WU_E_DS_MISSINGREF data bank of information is missing or has a reference to the missing license, file, localized property or line related.

    0 x 80248009 - the data store is in an invalid state, because it missing data that must be present. This will happen if we try to extract a line that is linked to another table and the related row does not exist. This can happen with the EULA, files and/or localized properties referenced by an update.

    Error when you try to use Microsoft Update or Windows Update Web sites to install updates: "0 x 80248009" http://support.microsoft.com/kb/956700>

    03/30 / 1101:36: 26 am

  • The Money data type

    I'm having a very difficult time to do a simple insert and update for columns with NUMBER data types (38.2) and NUMBER (10,0) on Oracle.

    These columns represent / gifts of money and they used to be defined as a MONEY data type and the data type TINYINT, respectively (when it was on non - Oracle DB)

    I used ColdFusion cf_sql_numeric, cf_sql_decimal and cf_sql_money, but all gave me error such as:

    The following information is for the creation of Web sites for debugging purposes.
    Error occurred while processing request

    Invalid data for CFSQLTYPE CF_SQL_NUMERIC 7,261.00.

    OR

    The following information is for the creation of Web sites for debugging purposes.
    Error occurred while processing request

    Invalid data for CFSQLTYPE CF_SQL_Double 7,261.00.

    When I run the following:

    < CFSET cash = ' #Replace(Form.Cash, "$", "", "ALL") # '>

    < CFSET CFM = ' #Replace(Form.CFM, "$", "", "ALL") # '>

    UPDATE Tbl_Gift

    FiscalYear = SET attributes

    < cfqueryparam cfsqltype ="cf_sql_varchar" Value =' #Form.FYR # '>,  

    CashAmount =

    < cfqueryparam cfsqltype ='cf_sql_numeric' value =' #Cash # '>,

    DonationAmount = 

    < cfqueryparam cfsqltype ='cf_sql_numeric' value =' #CFM # '>

    etc.

    I ran out of data type to use. What else can be used for the Oracle NUMBER data type (38.2) and NUMBER (10,0)? Help, please

    It is a comma in the number that is the cause of the problem in the

    CFQUERYPARAM.  REM before commas you save in the database and you

    should be good.

Maybe you are looking for

  • What Version of the utility Airport do I need?

    I have 2 Apple Airport Extreme Base Stations. On my old Dell Dimension 9200 running XP Professional Service Pack 3, I use Version 5.5.3 of Airport utility. Now, I want to download Airport utility for my new Dell Precision Tower 5810 running Windows 8

  • Cannot install update KB2431831

    For weeks, update has been insisting to only install Works 9 update KB2431831 using the Works 9 disc.  I can not find Works 9 installed on my computer or do I have to drive.  How can I do that, go away?

  • Use of the CPU 50% but System Idle process 98%

    Windows XP SP3 on an AMD x 2 processor. One of the nuclei seems to run at 90-100% depending on the Performance graph.  The status bar downstairs, explains the 50% CPU usage.  But when I look at a process it shows the system idle process 96-99%. Netwo

  • Disk space hard keeps being endangered? I am sure that I do not have a virus...

    I've recently updated my Vista to Service Pack 2, and a lot of problems arise.  I've never had these problems with Service Pack 1. (1) my hard drive space keeps disappearing.  I used to have 10 GB of free space and now he got up to 400 MBs.  Where is

  • HP Envy Ultrabook 4: Power on password or admin password?

    My laptop HP Envy Ultrabook 4 keeps giving me a problem when booting. Ask an administrator password or power on password. None of my passwords work and it crashes me and gives me a code. My code is 85374293