Can a Xquery return a concatenated string and an XML element

Hello

My Xquery fucntion is illustrated below:

It accepts parameters of Channel 4 and a XML element i.e., $Message which is a component of XML (application to come to the service) and I need to connect all this information in a log file.

I use the below fucntion concat to get a concatenated string of all parameters, but for $Message I m not able to get the XML load. How to achieve the same in the XQuery?

*$Message is the below XML file:*

payload of <>
< aa > a < /aa >
< bb > two < /bb >
< cc > 3 < /cc >
< / payload >

My Xquery function is:

declare function xf:XformLog($Name_as_xs:string,)
$id as XS: String.
$Context as XS: String.
$Annotation as XS: String.
$Message as element (*))
as XS: String {}
Concat ("name = ', $Name, ','," Id = ", $id,", ","Message = ", $Context,","context", Annotation = ", $Annotation,","," event Message = ', data ($Message/@*, $Message / node ()) "" "")
};


I am trying to achieve the following log:

Name = xyz, Id = 111, Message Contact is abc, Annotation = ggg, the event Message = < payload >
< aa > a < /aa >
< bb > two < /bb >
< cc > 3 < /cc >
< / payload >


How can I achieve the same. Please suggest.

Thanks in advance.

Published by: user9223904 on March 18, 2013 03:16

Hello

You must use a serialization function to convert a string of the instance of the element.
This type of functionality is not included in the XQuery standard, but many directors provide an extension to do this.

For example, in OSB, you can use fn - bea: serialize().

What is your environment and XQuery engine?

Tags: Oracle Development

Similar Questions

  • Preserve the font properties after concatenation string and control update

    Is there a better way to do it?  My method is unusably slow.  I played with several options (making assumptions of words separated by a space with the same fonts info, etc.), but I have not really found something that I am satisfied.

    David, updates FP method.  You update the text character by character properties. empty them in the buffer of transfer and update all at once.

  • Function - return multiple values in a concatenated string

    Hello

    Is it possible for a function return a concatenated string (combining more than one number). I'm trying to return the purchase by the introduction and invoice_id number and code order number, but an invoice_id can have several PO with the same code number. I want to concatenate the PO numbers with commas, for example

    10124, 10090, 10987

    At the present time, the function returns NULL for those cases that have more than one purchase order number.

    Thank you
    func_get_po(i.invoice_id, cc.code_combination_id) "PO No",
    func_get_po_requester(i.invoice_id, cc.code_combination_id, func_get_po(i.invoice_id, cc.code_combination_id)) "PO Requester",
    

    Of course, this can be done without any problem.
    If it returns NULL, then you must debug function and check the operating logic. I know that it will take a little of your time, but not problems with the logic of syntax and concatenation.

  • store the strings and numbers in a spreadsheet

    in this file, I understand that the data types are incorrect. But what I do not know how to solve this problem, then I can write arrays is full of strings and filled arrays of numbers to separate the columns in an excel worksheet.

    My suggestion will work fine. Insert function, I've mentioned in each of the DBL tables just before the table build.

  • Reading XML File.vi returns an empty string

    Hello

    I use reading of XML File.vi and this VI returns an empty string on my XML file, but on another XML file, it seems to work correctly.

    I open my file XML in Internet Explorer 7.0 and it apears as aspected.

    What could be the problem?

    Thanks in advance for any help.

    Kind regards

    Daniel Coelho

    You are right, and it seems to work as I want.

    Thank you for your help, this LabXML works well.

    This post is officially solved

    My best regards,

    Daniel Coelho

  • my default calendar on IPhone and IPad has disappeared. I can't see it either on ICloud and do not save on my Mac Book. How can I get it back? Is it possible to return to a previous update in ICloud?

    My default calendar on the IPhone (and IPad) disappeared. I can't see it either on ICloud and make the back not my calendars on my Mac Book. How can I get it back? Is it possible to return to a previous update in ICloud and find?

    Go to iCloud.com using a computer, then settings. When loading this page, look down at left under Advanced and see if you can restore from there.

  • My iphone will not suddenly be updated to icloud photos?  It has been working well recently and I tried restore, reboot, turn iclould off photos and return, etc...  can anyone help?  well worked yesterday and now not...

    My iphone will not suddenly be updated to icloud photos?  It has been working well recently and I tried restore, reboot, turn iclould off photos and return, etc...  can anyone help?  well worked yesterday and now not... most of the time the number of photos don't match same new how I am download to icloud...

    Have you tried the signature to iCloud and then reconnect?

    Try a reset.

    Reset device

  • I HAVE WINDOWS VISTA AND THE SIMS 2 ON MY COMPUTER BUT I TRIED TO INSTALL THE SIMS 3 BUT NOTHING HAPPENED! (CAN YOU BE RETURNED AS SOON AS POSSIBLE!)

    I INSTALLED THE SIMS 2 DELUX, SIMS 3 PETS AND SIMS 2 APARTMENT LIFE. I GOT SIMS 3 PUT HIM IN THE HARDRIVE HE RAN, BUT THE MESSAGE GAME NEVER TO SAY IF I WANT TO RUN IT HELP! PLEASE

    P.S. I HAVE WINDOWS VISTA

    THANKS X

    Welcome to the Microsoft Answers site.

    Well first thing to note - if you have Windows Vista, it is a forum for Windows 7, then you might have more luck in the Vista forum.  But second, you noted that you have installed the SIMS 2 Deluxe and the Sims 2 Apartment life and the SIMS 3 pets.  There are no SIMS 3 pets yet (only SIMS 2 Pets).  So who could have thrown people.

    So now REALLY tell you putting a SIMS 3 disc in?  If so, you must install the program first and sometimes automatic execution does.  You can, however, open a Windows Explorer (press the Windows key, key with the Windows Logo on it, down and self-tapping letter E - keep the E or you'll have a whole bunch of windows to the top).

    Then go to your CD/DVD drive and double-click it.  It can start the car then run.  If not, then you can right click on the drive icon and select EXPLORER and then find the file named SETUP.  If you don't see what he, or see the files, then make sure you have a valid PC version of the game and do not have a MAC version (my kids have committed this error several times while getting the library software).

    See if none of this helps and then after return. Bob Larson Access MVP

  • I just installed Lightroom CC 2015 and when it opens after 5 or 10 seconds video flashes up "" look at an overview of Lightroom and its features". It is not possible to cancel or return to Lightroom. I can just click on the play button and after that, Lig

    I just installed Lightroom CC 2015 and when it opens after 5 or 10 seconds video flashes up "" look at an overview of Lightroom and its features". It is not possible to cancel or return to Lightroom. I can just click on the play button and after that, Lightroom crashes.

    I uninstalled Lightroom, re-installed, but everything remains the same. After clicking on the play button, the video window is black. I can only kill Lightroom in the Task Manager.

    I use Windows 7.

    Thank you for helping me.

    OK guys, I have a solution. Press escape [ESC] to close the video window. Yes I know... It took less than hour of my time to understand this. If Adobe please, no matter how lucky you could focus on the provision of a useful product, not to invent unnecessary mess that have zero impact on your username? And Holy shit, employ a specialist UX, this is catastrophic!

  • How can I print out the string and whole the two together

    Hello

    My requirement is like printf in c statement.

    I have the 32 bit integer data table.

    I want to print in the labview as

    u32Data [0]: 0 x 12345

    u32Data [1]: 0 x 45566

    the same in the code c is

    for (i = 0; i<5;>

    printf ("[i] u32Data: 0 x %x", i, u32Data [i] ' ");

    in the same way as this how can print it in the palette string or any other.

    Hi Richard,

    use FormatIntoString in an autoindexing FOR loop:

  • LISTAGG function: "result of concatenating string is too long."

    Hello

    I use Oracle SQL developer 3.0.04 version. I tried using the LISTAGG function to group the data.
    CREATE TABLE FINAL_LOG AS
    SELECT SESSION_DT, C_IP, CS_USER_AGENT,
    listagg(WEB_LINK, ' ')
         WITHIN GROUP(ORDER BY C_IP, CS_USER_AGENT) "WEB_LINKS"
         FROM webviews
         GROUP BY C_IP, CS_USER_AGENT, SESSION_DT
         ORDER BY SESSION_DT
    However, I get the error message,

    SQL error: ORA-01489: result of concatenating string is too long

    Is it possible to go around it, or are there other alternatives?

    Tim Hall has a page on the various techniques of aggregation of chain that guides you through an example of creating and using a user-defined aggregate.

    On AskTom referenced by Tim page, there is an implementation of an aggregation function of string that returns a CLOB that you can use.

    If you want to understand what makes the user-defined aggregate function, it may look a bit complex, especially if you have never looked at object types in PL/SQL. You don't need to understand all the details of the implementation if you use just the code, however, you can simply create the function and use it as you would with any other aggregate function.

    Justin

  • search string and convert whole real or 8-bit 32 bit

    I was hoping to get some advice on how I could search for the following string and convert it to a real number or an integer.  The following data is output as a device ascii characters and I would look for both in each line (starting with 7699,72 seconds in this case) and convert each one to a real number.  Furthermore, I would like to get the integer values in each row (0, but could be 1,2,10,12, etc.) and convert them to an 8-bit integer.  I think that using the template Match followed by analysis of chain would screw that I need, but am not sure how to match in each case. Thank you!!
















    7699,72 0

    7699,74 0

    7699,76 0

    7699,78 0

    What are the characters in the white space between the and the numbers?

    Scan chain can probably not what you want.  Note that in the image space characters include spaces, return carriage, line breaks and tabs.

    Lynn

  • error "result of concatenating string is too long" when I try to run the following code. Help me!

    When I try to perform the following PROCEDURE, he throws me an error:

    Error from line: 2 in command.

    BEGIN

    FACT_UPDATE;

    END;

    Error report-

    ORA-01489: result of concatenating string is too long

    ORA-06512: at "AFLOBIDW. FACT_UPDATE', line 22

    ORA-06512: at line 2

    01489 00000 - "result of concatenating string is too long."

    * Cause: Result of concatenation of string exceeds the maximum size.

    * Action: Make sure that the result is less than the maximum size.

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

    I can't change the logic of the code since I'm trying to do Informatica at the back done and compare performance between Informatica and Oracle DB. Is there another solution for errors? I add only the SQL query that is part of the PROCEDURE for easy viewing. Please help me. Thank you!

    SELECT "UPDATE XXAFL_MON_FACTS_F SET TASK_WID ='"

    || NVL (TO_CHAR (TASK_WID), 'NULL')

    |', EXECUTION_PLAN_WID ='

    || NVL (TO_CHAR (EXECUTION_PLAN_WID), 'NULL')

    || ', DETAILS_WID ='

    || NVL (TO_CHAR (DETAILS_WID), 'NULL')

    |', SOURCE_WID ='

    || NVL (TO_CHAR (SOURCE_WID), 'NULL')

    |', TARGET_WID = '

    || NVL (TO_CHAR (TARGET_WID), 'NULL')

    || ', RUN_STATUS_WID ='

    || NVL (TO_CHAR (RUN_STATUS_WID), 'NULL')

    |', SEQ_NUM ='

    || NVL (TO_CHAR (SEQ_NUM), 'NULL')

    |', NAME = "'

    || NVL (TO_CHAR (NAME), 'NULL')

    || ' ', NO_POSITION = "'

    || NVL (TO_CHAR (INSTANCE_NUM), 'NULL')

    ||'' ', INSTANCE_NAME = "'

    || NVL (TO_CHAR (INSTANCE_NAME), 'NULL')

    || ' ', TYPE_CD = "'

    || NVL (TO_CHAR (TYPE_CD), 'NULL')

    ||'' ', STATUS_CD = "'

    || NVL (TO_CHAR (STATUS_CD), 'NULL')

    ||'' ', START_TS ='

    || DECODE (START_TS, ",' to_date(''e))

    || To_char (START_TS, "mm/dd/yyyy hh)

    ||'' ((', "dd/mm/yyyy hh")')

    || ', END_TS ='

    || DECODE (END_TS, ",' to_date(''e))

    || To_char (END_TS, "mm/dd/yyyy hh)

    ||'' ((', "dd/mm/yyyy hh")')

    |', DURATION = '

    || NVL (TO_CHAR (DURATION), 'NULL')

    |', STATUS_DESC = "'

    || NVL (TO_CHAR (STATUS_DESC), 'NULL')

    || ' ', DBCONN_NAME = "'

    || NVL (TO_CHAR (DBCONN_NAME), 'NULL')

    ||'' ', SUCESS_ROWS ='

    || NVL (TO_CHAR (SUCESS_ROWS), 'NULL')

    || ', FAILED_ROWS ='

    || NVL (TO_CHAR (FAILED_ROWS), 'NULL')

    |', ERROR_CODE = '

    || NVL (TO_CHAR (ERROR_CODE), 'NULL')

    |', NUM_RETRIES ='

    || NVL (TO_CHAR (NUM_RETRIES), 'NULL')

    || ', READ_THRUPUT ='

    || NVL (TO_CHAR (READ_THRUPUT), 'NULL')

    |', LAST_UPD = '

    || DECODE (LAST_UPD, ",' to_date(''e))

    || To_char (LAST_UPD, "mm/dd/yyyy hh)

    ||'' ((', "dd/mm/yyyy hh")')

    |', RUN_STEP_WID = "'

    || NVL (TO_CHAR (RUN_STEP_WID), 'NULL')

    || ' ', W_INSERT_DT = '

    || DECODE (W_INSERT_DT, ",' to_date(''e))

    || To_char (W_INSERT_DT, "mm/dd/yyyy hh)

    ||'' ((', "dd/mm/yyyy hh")')

    |', W_UPDATE_DT = '

    || DECODE (W_UPDATE_DT, ",' to_date(''e))

    || To_char (W_UPDATE_DT, "mm/dd/yyyy hh)

    ||'' ((', "dd/mm/yyyy hh")')

    || ', START_DATE_WID ='

    || NVL (TO_CHAR (START_DATE_WID), 'NULL')

    |', END_DATE_WID = '

    || NVL (TO_CHAR (END_DATE_WID), 'NULL')

    |', START_TIME ='

    || NVL (TO_CHAR (START_TIME), 'NULL')

    |', END_TIME ='

    || NVL (TO_CHAR (END_TIME), 'NULL')

    ||' WHERE INTEGRATION_ID = "'

    || INTEGRATION_ID

    ||''';' AS Column

    OF XXAFL_MON_FACTS_F;

    Hello

    ORA-01489 is one of these error messages that really means what he says. The error message you posted pretty much sums up the situation.

    What version of Oracle are you using?  (You must still include this whenever you have a question.  See the FAQ forum: Re: 2. How can I ask a question on the forums? )

    From 12.1 of the Oracle, there is an option to allow VARCHAR2s in SQL to be as big as 32767octets.  (The default is 4000).

    Otherwise, if you can't change the code, either do not run. or ensure that the concerned channels are quite short so the error does not occur.

  • Can a function returns a cursor?

    Hello
    can a function returns a cursor, or it may just return simple data types? If she can return a cursor which version is it possible?
    Thank you!

    Hi Mark,

    Some examples of the REF Cursor code.

    CREATE OR REPLACE FUNCTION emp_by_job (p_job VARCHAR2,p_deptno NUMBER,pv_table VARCHAR2)
    RETURN SYS_REFCURSOR
    IS
        emp_refcur      SYS_REFCURSOR;
    BEGIN
        OPEN emp_refcur FOR
        'SELECT empno, ename FROM '||pv_table||'  WHERE job = '||''''||p_job||''''||' and deptno= ' ||p_deptno; --Dynamic String where table name column values are parameters
        RETURN emp_refcur;
    END;
    
    DECLARE
      emp_refcur_local      SYS_REFCURSOR;
      empno NUMBER(4);
      ename VARCHAR2(30);
    BEGIN
      --Calling the function using parameters
      emp_refcur_local:=emp_by_job('MANAGER',10,'EMP');
      LOOP
      FETCH emp_refcur_local into empno,ename;
        EXIT WHEN  emp_refcur_local%NOTFOUND;
        DBMS_OUTPUT.PUT_LINE('Employee no: '||empno||'/ Employee name: '||ename);
      END LOOP;
    END;
    
  • Value derived — concatenated string fields

    Hi all

    could you please give an example how can I set a value derived from a string field, so that it is values concatenated from several other fields of type string.

    Basically, what I want to do is to collect all the keywords in a field.

    Kind regards
    Gulnara

    Hey guliflower,

    With the help of a comprehensive rule that I have validated only that it works for me:

    first the pseudocode:

    If CERTAIN CONDITIONS

    value = variable1 & 'separator' & variable2

    endif

    If you are a derivation based on string values in the localdata (e.g. of the metadata contained in a checkin form) then the "#active." FIELDNAME"works well
    Otherwise, you will need to write additional idoc for the channels that you want to concatenate. The "&" is the operator of concat idoc, as defined in the reference guide of the IDOCScript (http://download.oracle.com/docs/cd/E10316_01/cs/cs_doc_10/sdk/idoc_script_reference/wwhelp/wwhimpl/js/html/wwhelp.htm)

    Here's the working example that I used on my test system. I pulled the doctype string and the string of delimited by a pipe in the comments field security group.

    Here's the code I used:

    <$if #active.ddocauthor="" like="" "sysadmin"$="">
         <$dprDerivedValue=#active.dDocType &"|"&="" #active.dsecuritygroup$="">
    <$endif$>

    It derived from the string ' document | public' in my field of xComments.

    This is interpreted as server-side:
    If the current user on this request is "sysadmin" and then take the string value of the field dDocType add a pipe ' | ' character and add the string value of the dSecurityGroup field and then place all of the contents in the xComments field.

    hope that helps,
    Warmly,.
    Billy Cripe
    Fishbowl Solutions

Maybe you are looking for

  • Music videos in iWeb

    Having developed with happiness a beautiful five page site supporting our harp of the wind in the strings and flute, recent duo of a potential customer responded that the embedded audio clips do not work properly in his office. After testing with Saf

  • I can't print from the Internet, but my printer works fine with Internet Explorer

    When I try to print I am asked to save the file and get "unknown error." I can print with that printer from Internet Explorer. I uninstalled and reinstalled Firefox.

  • transferring files to the slow nas Server

    I just bought a new PC (HP Compaq) with Windows 8 and you have a NAS from Synology DS209 server. I joined this as a networkdrive, but it's extremely slow to copy files from the PC to the network (24 Kbps) drive. The two units are wired (no WIFI) dire

  • Upgrade RAM ProBook 6440 b

    Help! I'm trying to upgrade the RAM in my probook 6440 b It came with 2GB, and I want to bump it up to 8 GB. I already have very RAM, but can't access the slots of RAM (other than the one on the bottom of the unit). I believe that the slots are locat

  • Problem CSS - .muse Open file and styling is missing

    Hello worldI'm new to Muse and I'm having a devil of a time finding how CSS works with Muse.I take more than one project to someone else and cannot get it to render correctly. The exported files are previously correct when I open the HTML in a browse