Help On Concatenation using XMLAGG function [message #581766] |
Wed, 10 April 2013 07:55 |
fakru.y
Messages: 34 Registered: May 2007
|
Member |
|
|
Hi,
i'm having a scenario like this below. i have metric value for 60 weeks for a product. so basically i'll have 60 records for a single product. i need to combine the metric value for that product and generate a single record. for this i'm using XMLAGG function which is giving me a single record by concatenating the metric value. but the problem is i don't understand on what order the metric values is being concatenated. because when i see the data, concatenation metric value is not continuous weeks metric value. if i use START_WITH and CONNECT_BY clauses that also doesn't change my result. Please help me or provide your valuable suggestions. Below is the XMLAGG function which i'm using in my code.
rtrim(XMLAGG(XMLELEMENT(A,MET||'|')).EXTRACT('//text( )')) XYZ
Thanks in advance
Regards
Fakru.Y
|
|
|
Re: Help On Concatenation using XMLAGG function [message #581769 is a reply to message #581766] |
Wed, 10 April 2013 08:14 |
|
Michel Cadot
Messages: 68731 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
With any SQL or PL/SQL question, please, Post a working Test case: create table (including all constraints) and insert statements along with the result you want with these data then we will be able work with your table and data. Explain with words and sentences the rules that lead to this result.
Before, Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" or "Preview Quick Reply" button to verify.
Also always post your Oracle version, with 4 decimals.
And FEEDBACK to those that help, apart from from your first topic you NEVER did it, so we can't know if we helped you and so we can't know if it is worth to try to do it now.
Regards
Michel
|
|
|
|
|
Re: Help On Concatenation using XMLAGG function [message #581781 is a reply to message #581771] |
Wed, 10 April 2013 10:26 |
fakru.y
Messages: 34 Registered: May 2007
|
Member |
|
|
Thanks Everyone for your valuable suggestion. i included order by clause as "Jiri" said, and it is working. thanks for your support. Michel i'm sorry i didn't know that it will give such a bad impression that if i'm not giving my feedback. i'll make sure i'll provide my feedback in future.
|
|
|