In 9i XMLAGG use to merge lines

Hello

I have some standard SQL that returns:
Smith Parameter1 Value1
Smith Parameter2 Value2
Smith Parameter3 Value3
Jones Parameter1 Value1
Jones Parameter2 Value2
I want the output to be displayed in the form:
Smith Parameter1 Value1 Parameter2 Value2 Parameter3 Value3
Jones Parameter1 Value1 Parameter2 Value2
I've found that XMLAGG and XMLELEMENT functions make the case:
SELECT e.EMPLOYEE, RTRIM(XMLAGG(XMLELEMENT(my_element, p.P_NAME||' '||v.P_VALUE||' ')).extract('//text()'), ' ')
FROM my_employees e, my_parameters p, my_parameter_values v
WHERE v.P_ID = p.P_ID
AND v.EMP_ID = e.EMP_ID
GROUP BY e.EMPLOYEE
The only thing is, the SQL command order initially lines does not appear when they are merged in a single line, so I can get:
Smith Parameter1 Value1 Parameter3 Value3 Parameter2 Value2
Jones Parameter2 Value2 Parameter1 Value1
He returned in the correct order if I run the SQL without the XMLELEMENTS/XMLAGG function, so I guess it's a question of how the XMLAGG function parses the data?

Is that what I can do to fix this problem or is there another approach (in 9i) that I can use to get the required result?

Thank you very much

Bagpuss

Published by: Bagpuss on July 22, 2010 03:36

Published by: Bagpuss on July 22, 2010 03:39

Bagpuss says:
Is that what I can do to fix this problem or is there another approach (in 9i) that I can use to get the required result?

The ORDER BY for XMLAGG clause gives you good results?

SELECT e.EMPLOYEE, RTRIM(XMLAGG(XMLELEMENT(my_element, p.P_NAME||' '||v.P_VALUE||' ') ORDER BY p.P_NAME).extract('//text()'), ' ')
FROM my_employees e, my_parameters p, my_parameter_values v
WHERE v.P_ID = p.P_ID
AND v.EMP_ID = e.EMP_ID
GROUP BY e.EMPLOYEE

Tags: Database

Similar Questions

  • How to use the command line in w/Merge Vista?-need to cut password expires...

    I use Vista Home Basic by Fusion on a Mac Intel. The instructions to stop Vista expire a password is to use the command-line under Vista. I already know these instructions, so my question is:

    How to use the command line inside Vista, on a virtual machine?

    Thanks for your help in advance, I don't want to mess something else.

    Jacob.

    With assistance from the command-line on Vista is no different if it is to be run on a virtual machine or on a physical machine, so just like you would on any physical machine.

  • When using the merge and when to use updated

    Hi friends,

    Given the best performance... purpose of this discussion is when we should use statement UPDATE and when we should use MERGE statement in oracle update of thousands of records.

    Kindly Guide.

    Kind regards

    Himanshu

    Hello

    Looking for a couple to a few rules that you can use to decide whether to use the MERGE or UPDATE, without actually testing two meanings?

    If so, use MERGE when

    (1) (sometimes) need to add new lines

    (2) it is simpler.  This includes special cases

    (2A) an UPDATE statement uses a subquery in the SET clause and then (mostly) repeats the same subquery in the WHERE clause

    (2B) you want to use the analytical functions or CONNECT BY in a subquery

    These rules are NOT guaranteed to work in all situations.

    Kimmy says:

    Hello

    ... My requirement is only UPDATED records about 200 to 500K (NOT followed by update of insertion).

    So the rule (1) above does not apply in this case.

    What I observed in the update using a MERGE statement and UPDATE is:

    Update with the MERGER was faster however explain the bytes consumed to the query plan MERGE has been compared more update.

    Use the tool that works best for your needs.  If users are complaining that something shows more bytes used in a plan to explain, so maybe it's a reason for the UPDATE.

    Where I work, where is the fastest is usually more important.

    In addition, I want to get clearity

    1. "if I should use MERGE if I need to update recrods using the unique table" as shown below: OR update will be good to use in this case:

    MERGE INTO MKT_DATA inmkt

    C using (SELECT Customer_Code, region, State OF CUSTOMER_DATA)

    ON (inmkt. Distributor_Code = c.Customer_Code AND inmkt. DISTRIBUTOR_CODE IS NOT NULL)

    WHEN MATCHED THEN

    Updated the inmkt VALUE. Distributor_Region = c.Region,

    inmkt. C.State = Distributor_Province;

    UPDATE MKT_DATA inmkt

    SET (inmkt. Distributor_Region, inmkt. Distributor_Province) =

    (SELECT c.Region, c.State OF CUSTOMER_DATA c

    WHERE c.Customer_Code = inmkt. Distributor_Code)

    WHERE inmkt. DISTRIBUTOR_CODE IS NOT NULL;

    2 statements above are not equivalent.

    The UPDATE statement changes all the lines in the table mkt_data that have a distributor_code, this distributor_code be in the table customer_data or not.

    You want something that is equivalent to the MERGE statement, you can use:

    UPDATE MKT_DATA inmkt

    SET (inmkt. Distributor_Region, inmkt. Distributor_Province) =

    (SELECT c.Region, c.State

    OF CUSTOMER_DATA c

    WHERE c.Customer_Code = inmkt. Distributor_Code

    )

    WHERE THERE ARE

    (SELECT 1

    CUSTOMER_DATA C2

    WHERE the c2. Customer_Code = inmkt. Distributor_Code

    )

    ;

    It basically uses the same auxiliary request 2 times (article 2 (a), so I would use MERGE if these are the results I wanted.

    If you have a foreign key constraint, which ensures that each distributor_code in mkt_data will match a line in customer_data, then the 2 statements above will produce the same results.  In this case, I find the UPDATE statement simpler and probably use it rather than MERGE.

    2. to Updating huge amount of records MERGER must be used instead of update?

    I don't know of all short reign as the "use X whenever you have more than 100,000 lines".

    3. If in the update, I need to use several tables then I have to use MERGE?

    MERGE IN MKT_DATA2 t

    WITH THE HELP OF)

    SELECT DISTINCT srt. Sales_Id, tmkt. Cust_Code, srt. PRODUCT_CENTER

    OF srt, CUSTOMER_DATA c, MKT_DATA2 tmkt SALESTERR_PL

    WHERE tmkt.state_Id = 10423

    AND tmkt. Business = 'MARKETING'

    AND c.CUST_CODE = tmkt. Cust_Code

    AND c.Rollup_Code = srt. CUST_CODE

    AND srt. PRODUCT_CENTER = tmkt.PL

    ) d

    WE (t.state_Id = 10423

    AND t.BA = 'MARKETING'

    AND t.Cust_Code = d.Cust_Code

    AND t.PL = d.PRODUCT_CENTER

    AND t.Cust_Code IS NOT NULL

    )

    WHEN MATCHED THEN

    UPDATE SET t.Sales_Id = d.Sales_Id;

    UPDATE MKT_DATA2 tmkt

    SET Sales_Id = (SELECT SALES_ID OF SALESTERR_PL srt

    WHERE the srt. CUST_CODE = (SELECT ROLLUP_CODE FROM CUSTOMER_DATA c

    WHERE c.CUSTOMER_CODE = tmkt. Cust_Code)

    AND srt. PRODUCT_CENTER = tmkt.PL)

    WHERE business = 'MARKETING'

    AND state_Id = 10423;

    Once again, those who are not equivalent.  The UPDATE statement can change more lines than the MERGE statement.

    In addition, you can use the MERGE statement:

    MERGE IN MKT_DATA2 t

    WITH THE HELP OF)

    SELECT DISTINCT srt. Sales_Id, tmkt. Cust_Code, srt. PRODUCT_CENTER

    OF srt, CUSTOMER_DATA c, MKT_DATA2 tmkt SALESTERR_PL

    WHERE tmkt.state_Id = 10423

    AND tmkt. Business = 'MARKETING'

    AND c.CUST_CODE = tmkt. Cust_Code

    AND c.Rollup_Code = srt. CUST_CODE

    AND srt. PRODUCT_CENTER = tmkt.PL

    ) d

    WE (t.Cust_Code = d.Cust_Code

    AND t.PL = d.PRODUCT_CENTER

    )

    WHEN MATCHED THEN

    UPDATE SET t.Sales_Id = d.Sales_Id

    WHERE t.state_Id = 10423

    AND t.BA = 'MARKETING'

    - AND t.Cust_Code IS NOT NULL - does not need, said subquery 'c.CUST_CODE = tmkt. Cust_Code ".

    ;

    If you would care to publish the sample data, I was able to test this.

    4. when the UPDATE is preferred over the MERGER?

    In simple cases, including situations where all you need to know are on the line itself, such as:

    UPDATE emp

    SET sal = sal * 1.05

    Job WHERE NOT IN ('MANAGER', 'PRÉSIDENT')

    ;

  • M40X: using digital telephone line with modem internal

    the M40 X manual says use digital telephone line with the internal modem, in zimbabwe, all lines are digital until to now do for telephone line

    [Edited by: admin August 10 05 21:19]

    Hallo nasir

    You are right. Connect the modem to a digital telephone line. As far as I know, the tension is much higher by digital line and it can damage the equipment.

    In my opinion the best solution for you is an external digital modem.

    Good bye

  • The list of permissions of the files using the command line

    Hi all

    My windows operating system is windows Server 2003 R2.

    Now, I'm trying to find a solution that can display all the permissions of the file of each folder and its subdirectory by using the command line syntax.
    I tried to use ICACLS to solve this problem, but its result contains the permissions of all files/folders. I just want to have the permission of files, not the permissions of each individual files.

    Is it possible to just show the permissions of folders with ICACLS? If it is possible, what sentence from command line?

    However, I also looked at Systinterals AccessChk and AccessEnum without finding a solution.

    If you have no good solution, please share with me.

    Advanced thanks.

    Hi Leo,

    The question you have posted is related to file permissions in Server 2003 and it would be better suited to the TechNet community.

    Please visit the link below to find a community that will provide the support you want.

    http://social.technet.Microsoft.com/forums/en-us/winserversecurity/threads

    Hope it will be useful.

  • Install programs by using the command line?

    My computer will not install packaged with Bitrock Installer programs.  How to do this? I used the command line in the past, but I forgot how.  It must be installed all by activating not the installer to Bitrock.  Or what I can do for my computer compatible with the Bitrock Installer?

    Hi sallysantlerart,

    1. what program are you trying to install?

    2. what happens when you try to install the program?

    You can consult the following links to install the program by using the command line:

    http://msdn.Microsoft.com/en-us/library/aa372024 (v = vs. 85) .aspx

    http://msdn.Microsoft.com/en-us/library/Aa367988 (v = vs. 85) .aspx

    Hope this information is useful.

    Jeremy K
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

    If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • The application has failed to start because its side-by-side configuration is incorrect. See the application event log or use the command-line sxstrace.exe for more details

    Hello

    I can t open Google Earth or Microsoft Office programs because I get this message - the application could not start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe for more details.

    A few days ago I could open all what programs. I put t know what is the problem.

    I did sxstrace and that's what I have-

    =================
    Launch the activation context generation.
    Input parameter:
    Flags = 0
    ProcessorArchitecture = Wow32
    CultureFallBacks = en-US; en
    ManifestPath = C:\Program Files (x 86) \Google\Google Earth\client\googleearth.exe
    AssemblyDirectory = C:\Program Files (x 86) \Google\Google Earth\client\
    Application configuration file =
    -----------------
    INFO: File analysis shows C:\Program Files (x 86) \Google\Google Earth\client\googleearth.exe.
    INFO: Manifest definition identity is (null).
    INFO: Reference: Microsoft.VC80.CRT, processorArchitecture = "x 86" publicKeyToken = "1fc8b3b9a1e18e3b", type = "win32", version = "8.0.50727.4053"
    INFO: Resolving reference Microsoft.VC80.CRT, processorArchitecture = "x 86" publicKeyToken = "1fc8b3b9a1e18e3b", type = "win32", version = "8.0.50727.4053".
    INFO: Resolving reference for ProcessorArchitecture WOW64.
    INFO: Resolving reference for the neutral culture.
    INFO: Application binding policy.
    INFO: No found publisher policy.
    INFO: No redirect political connection is found.
    INFO: Start the detection of assembly.
    INFO: Can't find the assembly in WinSxS.
    NEWS: Try to detect manifest to C:\Windows\assembly\GAC_32\Microsoft.VC80.CRT\8.0.50727.4053__1fc8b3b9a1e18e3b\Microsoft.VC80.CRT.DLL.
    INFO: Found no manifesto for the neutral culture.
    INFO: End detection of assembly.
    INFO: Resolving reference for ProcessorArchitecture x 86.
    INFO: Resolving reference for the neutral culture.
    INFO: Application binding policy.
    NEWS: Control strategy of the Publisher C:\Windows\WinSxS\manifests\x86_policy.8.0.microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.5592_none_517247830f45081d.manifest
    INFO: Start the detection of assembly.
    INFO: End detection of assembly.
    ERROR: Activation context generation failed.
    End activation context generation.

    Help, please!

    This type of error can be caused if the Visual C++ library runtime components are missing or because of a third-party software.

    Follow the steps below:
     
    Method 1:
    If the problem is caused by the lack of Visual C++ libraries, you can download and install the Runtime components of Visual C++ libraries from the link below:
     
    This error can occur when the Microsoft .NET Framework installation on the computer is damaged or is missing.

    Try it out below step to reinstall and repair installation of Microsoft .NET Framework on the computer, then check if you can install the software.

    (a) click the Start button, select Control Panel, click programs and then click on 'Turn Windows has or not.' If you are prompted for an administrator password or a confirmation, type the password or provide confirmation.

    (b) search for Microsoft .NET framework 3.5.1 uncheck, click OK and restart the computer.

    (c) after the reboot, open again "Turn Windows features on or off" and place a check next to Microsoft .NET framework 3.5.1 and restart the computer.

    Step 2

    If the previous step fails, then I suggest that you manually download and install Microsoft Visual C++ 2005 and 2008 Redistributable Package and check to see if you can install the software.

    In programs and features, you do not show that you have installed Microsoft Visual C++ 2005 Redistributable and Microsoft Visual C++ 2008 Redistributable? If this is not the case, download the links here.
     
    Package redistributable Visual C++ 2005 (X 86)
     http://www.Microsoft.com/downloads/en/details.aspx?FamilyId=32BC1BEE-A3F9-4C13-9C99-220B62A191EE&displaylang=en
     
    Visual C++ 2005 (x 64) redistributable package manager
     http://www.Microsoft.com/downloads/en/details.aspx?FamilyId=eb4ebe2d-33c0-4A47-9dd4-b9a6d7bd44da&displaylang=en

    Package redistributable Microsoft Visual C++ 2008 (x 86)

    http://www.Microsoft.com/downloads/en/details.aspx?FamilyId=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF&displaylang=en

    Package redistributable Visual C++ 2008 SP1 (x 64)
     http://www.Microsoft.com/downloads/en/details.aspx?FamilyId=BA9257CA-337F-4B40-8C14-157CFDFFEE4E&displaylang=en

    I hope this helps.

  • "Error: the application failed to start because the side by side configuration is incorrect, please see the application event log or use the command-line sxstrace.exe for more details.

    I have QQ (an international chat program) installed on the laptop. Then my hard drive crashed. Now when I try to reinstall it on my new hard drive I get the following message:

    "Error: the application failed to start because the side by side configuration is incorrect, please see the application event log or use the command-line sxstrace.exe for details" -how can I solve this problem? I have Windows 7.

    Hello

    Thanks for choosing Microsoft Community to post your question.

    It seems that you can not install application QQ, you get an error: "the application could not start because the side by side configuration is incorrect, please see the application event log or use the command-line sxstrace.exe for more details.

    We're here to help and guide you in the right direction. This problem could be caused when the computer is missing the correct C++ run time for your type of system components. (x 86 or x 64).

    Here are a few troubleshooting steps that you can try to solve this problem.

    Method 1: we will install Microsoft Visual C++ for your computer package.

    Note: If you use the 32-bit operating system, download and install 32-bit edition(X86).

    If you use the 64-bit operating system, download and install edition(X64) 64-bit.

    Microsoft Visual C++ 2008 SP1 Redistributable Package (x 86)
    http://www.Microsoft.com/downloads/en/details.aspx?FamilyId=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en

    Microsoft Visual C++ 2008 SP1 Redistributable Package (x 64)
     http://www.Microsoft.com/downloads/en/details.aspx?FamilyId=BA9257CA-337F-4B40-8C14-157CFDFFEE4E&displaylang=en

    Package redistributable Microsoft Visual C++ 2010 (x 86)

    http://www.Microsoft.com/downloads/en/details.aspx?FamilyId=a7b7a05e-6de6-4D3A-A423-37bf0912db84

    Package redistributable Microsoft Visual C++ 2010 (x 64)

    http://www.Microsoft.com/downloads/en/details.aspx?FamilyId=bd512d9e-43c8-4655-81bf-9350143d5867

    Method 2: Run the fixit available at the following link.

    Solve problems with programs that cannot be installed or uninstalled

    http://support.Microsoft.com/mats/Program_Install_and_Uninstall

    Also, check the event log using Event Viewer.

    Please see the link below for more information on how to use Event Viewer to check the error message or information,

    http://Windows.Microsoft.com/en-us/Windows7/what-information-appears-in-event-logs-Event-Viewer

    If you have additional problems, please reply to this post and we will be happy to help you further.

  • How sleep windows 7/8 using the command line?

    How sleep windows 7/8 using the command line?

    for example:-l is for disconnection, what command should I give to sleep?

    Hello

    Powercfg command-line options
    http://TechNet.Microsoft.com/en-us/library/cc748940 (v = WS.10) .aspx

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle="" -="" mark="" twain="" said="" it="">

  • Error: you have an error in your SQL syntax; consult the manual for your version of the MySQL server for the right syntax to use near ')' at line 5

    Original title: how to solve this problem:

    System error

    You have an error in your SQL syntax; consult the manual for your version of the MySQL server for the right syntax to use near ')' at line 5

    Hi Roger,

    It seems that you have problems with the SQL syntax. The question you have posted is related to encoding and it would be better suited to the MSDN Community. Please report it in the community below.

    http://social.msdn.Microsoft.com/forums/SQLServer/en-us/home

    Hope this is useful.

  • WINDOWS 7 error the application failed to start because the side by side configuration is incorrect, please see the application event log or use the command-line sxstrace.exe for more details.

    «WINDOWS 7 error the application failed to start because the side by side configuration is incorrect, please see the application event log or use the command-line sxstrace.exe for more details.»

    This cams almost for all the applications that I try to open. I read all kinds of things to solve problems, but I can't install anything because it is constantly on the screen.

    I think it's like that because my computer shuts off when I was doing the system restore, because he has not started.

    I don't know what to do.

    Hello

     
    You can view the event log by using Event Viewer. See the link below for more information about how to use Event Viewer to check the error message or information,
     
    Please check the information in Event Viewer and let us know the problem more briefly for a better solution.
     

    Method 1:
    However, try the SFC (System File Checker) scan on the computer. Check out the following link to do the same thing:
    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
     
    Method 2:
    You try to run the fixit given in the following link and check if it works:
  • Use the command line to call EX60/C40

    Hello

    I'm looking to use the command line or xml to call extensions of our EX60 and C40. I want to automate the call made by the devices. We use 9.1 CM and TC6.

    In addition, if someone knows if it is possible to configure ERA/Hot Dial so when a user picks up the phone on the EX60 it automatically connect an extension? I tried through dialing SIP and ERA rule in CUCM.

    Thank you

    Kaleb

    To dial the command line, you can use the command 'xcommand dial.

    xCommand Dial

    Dial a number from the system. Returns information on the CallId and ConferenceId, which are necessary for some other commands.

    Number: Enter the number or address.

    Protocol: Select the Protocol h.323 or SIP.

    CallRate: Fix a rate of call.

    CallType: Select the type of audio or video call.

    BookingId: any identifier that an external booking system (e.g., TMS, CTS - MAN) can use for its own references to match calls placed with the internal identifier systems of booking for a meeting. This can be any string, for example, a GUID. The reservation Id will be provided in the call connects, events of appeal etc. for the call.

    Requires the user role: USER

    Parameters:

    Number (r):
    Protocol:
    CallRate:<64..6000>
    CallType:
    BookingId:

    Example:

    xCommand Dial number: 543210 Protocol: h323
    Ok
    * r DialResult (status = OK):
    CallId: 2
    ConferenceId: 1
    * end

  • Get Null value online by using the reference line.

    Hi guys,.

    I get the null value of the line everytime I use the reference line. Here is my code.

    String rowReference = pageContext.getParameter (OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);

    Line OARow = (OARow) am.findRowByRef (rowReference);

    System.out.println ("row" + Row);

    If (line! = null)

    {

    System.out.println ("Surfing");

    Object succObj = row.getAttribute ("INTERFACE_HEADER_ID");

    String succStr = succObj.toString ();

    throw new OAException ("" + succStr, OAException.INFORMATION);

    }

    Thank you

    I found workaround to get a current line like «($OA.» CURRENT. Id_interface)"as REFERENCE of the LINE does not work. I'm passing the parameter to my Textinputbean in the application of process method and by capturing the current values in the process of request form

    Treat the claim code

    Hashtable params = new Hashtable (1);

    params.put ("param1", pageName);

    Hashtable paramsWithBinds = new Hashtable (1);

    paramsWithBinds.put ("param2", new OADataBoundValueFireActionURL (oamessage, "{$INTERFACE_HEADER_ID}" ""));

    updateIcon.setFireActionForSubmit ("updateRecord", params, paramsWithBinds, false, false);

    Process form Code

    If ('updateRecord".equals (pageContext.getParameter (OAWebBeanConstants.EVENT_PARAM)))

    {

    System.out.println ("after" m "+ pageContext.getParameter ("param2")); / / give you current value as $OA. CURRENT. ID_INTERFACE

    }

  • Can I use dynamic subject line in email?

    Hello

    Can I use dynamic subject line in email?

    Hi Sanjiv yadav, Yes, we do. For this we need to put dynamic content on this particular line or section. Thanks, Eloqua Expert

  • Custom signature using mail merge document?

    I would like to send a custom for the signature document. Each document would require 2 signatures.

    I am able to work out how to distribute to each person for their signature, however it is possible to use a merge and mail for the "customization" process uses Word or Acrobat, to ensure that the appropriate recipient receives their agreement?

    Hi ChurchieIT,

    To work around the problem, you can use MegaSign function with which you can send the same document up to 300 recipients (supplied by upload of a CSV file which their information). By default, it can have a signature and others like signature countersignature of sender (which is always fixed). Here is the link for reference:

    https://helpx.Adobe.com/content/help/en/document-cloud/help/sending-megasign-using-CSV-fil.html

    -Usman

Maybe you are looking for

  • How can I change the language on the toolbar to English that seems to be in Greek or Italian?

    The toolbar or Firefox, as I use it, turned suddenly is a transcription for the Greeks or Italians. I am a speaker of English and don't understand or the other language. What interests me is how can I change the language of the toolbar Firefox back t

  • How to send 2 bytes per uart data

    Hi all I want to send data hex 16-bit serial of the uart. I took a picture of representation 132 and selected hexadecimal in its properties. to convert this table to string, I chose the byte to string conversion and this connected to writing series V

  • Network of RT - PC streaming

    Hi all! I need to ask for your help with network streaming that I am completely blue in this topic. I am trying ro receive data from the RT_Main.vi on my Host_Main.vi (PC). I tried to register my computer IP address and sbRIO same IP address, I tried

  • error 5200 on a Canon MP490

    have put in a new cartridge and the answer is error 5200 and no printing

  • Cannot use command line commands.

    I am trying to install a router on my computer.  I make all the connections and then try to configure the router. To do this, I need to go to the shell.  I have to start > RUN > cmp.  The shell comes up enter the following: C:\>ping 192.168.1.1 the f