2 Replies Latest reply: Aug 16, 2013 4:23 AM by HenkB RSS

    strange string-join behaviour

    HenkB

      HI,

       

      I tested the following query in 10gr2 and 11gr2

       

      SELECT XMLQuery('string-join("a","b")'

                      returning content) as output

        FROM DUAL;

       

      Result => a and  NOT ab.

       

      Any idea why this result?

       

      Thanks,

       

      Henk

        • 1. Re: strange string-join behaviour
          odie_63

          Some doc reading might help : fn:string-join()

           

          The function concatenates a sequence of strings (first arg) into a single string using the second arg as separator.

          In your example, the sequence consists in a single item so the result is the item itself.

           

          Are you looking for fn:concat() ?

          SQL> select xmlquery('concat("a","b")' returning content)

            2  from dual;

           

          XMLQUERY('CONCAT("A","B")'RETU

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

          ab

          • 2. Re: strange string-join behaviour
            HenkB

            Hi Odie,

             

            Thanks, I see that  a#b can be done by

            SELECT XMLQuery('string-join(("a","b"),"#")'

                            returning content) as output

              FROM DUAL;

             

            select XMLQUERY('string-join(for $i in ora:view("OE", "ORDERS")/ROW/ORDER_ID/text()

                             return $i, ",")'

                     returning content) as output

                from dual

            is OK in 11gr2

            but NOT OK in 10gR2 ORA-19112:... Conversion to string failed.....???

            frustrating...

             

            Any solution that the query works for Oracle10Gr2? Message was edited by: HenkB