2 Replies Latest reply: Dec 11, 2012 4:40 AM by 976707 RSS

    10.2 equivalent to xmlexists - existsnode?

    976707
      Hi

      When I was trying to compile a procedure on a 10.2 server I realized that it doesn't support XMLEXISTS, what is the recommended 10.2 equivalent, existsnode?

      I might be doing it all wrong though, I need to count the number of occurences of a certain node, I haven't found a better way than looping through the data and querying it if a certain occurence exists:
      select 1
      from test_table t
      where xmlexists('declare default element namespace "urn:iso:std:iso:20022:tech:xsd:camt.053.001.02"; (: :)
                       $root/Document/BkToCstmrStmt/Stmt[$id]'
                      passing object_value as "root"
                      , cast(b_stmt_nr as number) as "id"
                      )
      In theory, the occurences might be more than 1, in practice it is always 1, but I still have to check. Is there an altogether better way to count the nodes?
        • 1. Re: 10.2 equivalent to xmlexists - existsnode?
          odie_63
          When I was trying to compile a procedure on a 10.2 server I realized that it doesn't support XMLEXISTS, what is the recommended 10.2 equivalent, existsnode?
          Yes, it's existsNode.
          I might be doing it all wrong though, I need to count the number of occurences of a certain node, I haven't found a better way than looping through the data and querying it if a certain occurence exists
          Not sure what you're after exactly.
          This will count the number of Stmt element :
          select count(*)
          from test_table t
             , xmltable(
                 xmlnamespaces(default 'urn:iso:std:iso:20022:tech:xsd:camt.053.001.02')
               , '/Document/BkToCstmrStmt/Stmt'
                 passing t.object_value
               )
          ;
          Is that what you need?
          • 2. Re: 10.2 equivalent to xmlexists - existsnode?
            976707
            That's exacly what I needed, thanks!