Multiple rows into single pipe delimited row ........

Hi All
I have the following data in multiple columns which needs to be converted into single pipedelimited row.
Followinf is the example:
DEPTNO ENAME
===== =====
10 A
10 B
10 C
Now my requirement is in output i should be able to display A|B|C|.........
Note : The number of rows for any DEPTNO are not constant.
Thanks,
kalyan Kumar P

Hi,
I tried but it is not throwing error that "Invalid Identifier" and moreover you told it is undocumentes
please tell me what i need to do to to make "wm_concat" work.If there is any alternate also please let me know.In your database WMSYS user is not created that is why you are not getting 'wm_concat' function.
Create WM_CONCAT function with this
CREATE OR REPLACE TYPE BODY wm_concat
IS
   STATIC FUNCTION odciaggregateinitialize (sctx IN OUT wm_concat)
      RETURN number
   IS
   BEGIN
      sctx :=   wm_concat (NULL);
      RETURN odciconst.success;
   END;
   MEMBER FUNCTION odciaggregateiterate (self IN OUT wm_concat, p1 IN varchar2)
      RETURN number
   IS
   BEGIN
      IF (curr_str IS NOT NULL)
      THEN
         curr_str :=   curr_str || ' , ' || p1;
      ELSE
         curr_str :=   p1;
      END IF;
      RETURN odciconst.success;
   END;
   MEMBER FUNCTION odciaggregateterminate (self IN wm_concat, returnvalue OUT varchar2, flags IN number)
      RETURN number
   IS
   BEGIN
      returnvalue :=   curr_str;
      RETURN odciconst.success;
   END;
   MEMBER FUNCTION odciaggregatemerge (self IN OUT wm_concat, sctx2 IN wm_concat)
      RETURN number
   IS
   BEGIN
      IF (sctx2.curr_str IS NOT NULL)
      THEN
         self.curr_str :=   self.curr_str || ' , ' || sctx2.curr_str;
      END IF;
      RETURN odciconst.success;
   END;
END;
CREATE OR REPLACE FUNCTION wm_concat (p1 varchar2)
   RETURN varchar2
   AGGREGATE USING wm_concat;
   After creating this function try this query
SELECT REPLACE (wm_concat (ename), ',', '|') ename FROM emp;Let me know if problem persist.
Regards,
Mahesh Kaila

Similar Messages

  • Convert  multiple rows into single rows for the respective index name

    Dear Experts,
                             I want to convert  multiple rows into single rows for the respective index name,
                            Here is my query.
    SELECT user_tables.table_name, user_indexes.index_name, user_ind_columns.column_name
    FROM user_tables
    JOIN user_indexes on user_indexes.table_name = user_tables.table_name
    join USER_IND_COLUMNS on USER_INDEXES.INDEX_NAME = USER_IND_COLUMNS.INDEX_NAME
    where user_indexes.index_name not like '%PK%' AND user_ind_columns.column_name NOT LIKE '%SYS%'
    ORDER BY user_tables.table_name,user_indexes.index_name;
    Result of previous query
    TABLE_NAME
    INDEX_NAME
    COLUMN_NAME
    T1
    IDX_ACCNTYPCFG1
    ENABLE_SERVICE
    T1
    IDX_ACCTTYPCFG1
    ACC_CODE
    T1
    IDX_ACCTTYPCFG1
    ACCTYPE
    T2
    IDX_ACCTTYPCFGAPP1
    ACCTYPE
    T3
    IDX_ACTLG1
    MOBILE_NO
    T3
    IDX_ACTLG1
    ID
    Desired output required is
    TABLE_NAME
    INDEX_NAME
    COLUMN_NAME
    T1
    IDX_ACCNTYPCFG1
    ENABLE_SERVICE,ACC_CODE,ACCTYPE
    T2
    IDX_ACCTTYPCFGAPP1
    ACCTYPE
    T3
    IDX_ACTLG1
    ACCTYPE,MOBILE_NO
    please help.

    Maybe
    with
    user_tables as
    (select 'T1' table_name,'IDX_ACCNTYPCFG1' index_name,'ENABLE_SERVICE' column_name from dual union all
    select 'T1','IDX_ACCTTYPCFG1','ACC_CODE' from dual union all
    select 'T1','IDX_ACCTTYPCFG1','ACCTYPE' from dual union all
    select 'T2','IDX_ACCTTYPCFGAPP1','ACCTYPE' from dual union all
    select 'T3','IDX_ACTLG1','MOBILE_NO' from dual union all
    select 'T3','IDX_ACTLG1','ID' from dual
    select table_name,
           case index_name when 'IDX_ACCNTYPCFG1' then 'IDX_ACCTTYPCFG1' else index_name end index_name,
           listagg(case column_name when 'ID' then 'ACCTYPE' else column_name end,',') within group (order by null) column_name
      from user_tables
    group by table_name,case index_name when 'IDX_ACCNTYPCFG1' then 'IDX_ACCTTYPCFG1' else index_name end
    TABLE_NAME
    INDEX_NAME
    COLUMN_NAME
    T1
    IDX_ACCTTYPCFG1
    ACCTYPE,ACC_CODE,ENABLE_SERVICE
    T2
    IDX_ACCTTYPCFGAPP1
    ACCTYPE
    T3
    IDX_ACTLG1
    ACCTYPE,MOBILE_NO
    Regards
    Etbin

  • Merge multiple rows into single row (but multiple columns)

    How to merge multiple rows into single row (but multiple columns) efficiently.
    For example
    IDVal IDDesc IdNum Id_Information_Type Attribute_1 Attribute_2 Attribute_3 Attribute_4 Attribute_5
    23 asdc 1 Location USA NM ABQ Four Seasons 87106
    23 asdc 1 Stats 2300 91.7 8.2 85432
    23 asdc 1 Audit 1996 June 17 1200
    65 affc 2 Location USA TX AUS Hilton 92305
    65 affc 2 Stats 5510 42.7 46 9999
    65 affc 2 Audit 1996 July 172 1100
    where different attributes mean different thing for each Information_type.
    For example for Information_Type=Location
    Attribute_1 means Country
    Attribute_2 means State and so on.
    For example for Information_Type=Stats
    Attribute_1 means Population
    Attribute_2 means American Ethnicity percentage and so on.
    I want to create a view that shows like below:
    IDVal IDDesc IDNum Country State City Hotel ZipCode Population American% Other% Area Audit Year AuditMonth Audit Type AuditTime
    23 asdc 1 USA NM ABQ FourSeasons 87106 2300 91.7 46 85432 1996 June 17 1200
    65 affc 2 USA TX AUS Hilton 92305 5510 42.7 46 9999 1996 July 172 1100
    Thanks

    Hi,
    That's called Pivoting . The forum FAQ has a section on this subject: {message:id=9360005}
    I hope this answers your question.
    If not, post your best attempt, along with a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data. (You did post the results you wanted, but they're very hard to read because they're not formatted. Use \ tags, as described in the forum FAQ, below.)
    Explain, using specific examples, how you get the results you want from the data given.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).  This is always important, but especially so with pivots.
    See the forum FAQ {message:id=9360002}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Scanning multiple pages into single document

    Is there a way to scan multiple pages into single document?  I am using the following: HP pavilion laptop with windows 8,  HP photosmart C6380 all in one printer scanner copier.

    Hi,
    Please try
    Double click printer icon on desktop,
    Select Scan a Document or Photo,
    Put the first page on the glass (face down),
    Check options (size, dpi ...), and select Scan document to file,
    Click Scan - machine will scan the first page
    Remove the first page on the glass, put the second page,
    Click + (plus sign) It sits on the left hand side of a red x
    Machine will scan the second page, put 3rd page on the glass and click + again ..... to the end then click Save
    Click Done after Save
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • How to Pass multiple parameter into single store procedure

    How to Pass multiple parameter into single store procedure
    like a one to many relationship.
    it is possible then reply me immediatly

    you mean like this .....
    CREATE OR REPLACE procedure display_me(in_param in varchar2,in_default in varchar2 := 'Default') is
    BEGIN
    DBMS_OUTPUT.put_line ('Values is .....'||in_param || '....'||in_default);
    END display_me;
    CREATE OR REPLACE procedure display_me_2 as
    cnt integer :=0;
    BEGIN
    For c1_rec In (SELECT empno,deptno FROM test_emp) Loop
         display_me(in_param => c1_rec.empno);
         cnt := cnt+1;
         end loop;
         DBMS_OUTPUT.put_line('Total record count is ....'||cnt);
    END display_me_2;
    SQL > exec display_me_2
    Values is .....9999....Default
    Values is .....4567....Default
    Values is .....2345....Default
    Values is .....7369....Default
    Values is .....7499....Default
    Values is .....7521....Default
    Values is .....7566....Default
    Values is .....7654....Default
    Values is .....7698....Default
    Values is .....7782....Default
    Values is .....7788....Default
    Values is .....7839....Default
    Values is .....7844....Default
    Values is .....7876....Default
    Values is .....7900....Default
    Values is .....7902....Default
    Values is .....7934....Default
    Values is .....1234....Default
    Total record count is ....18

  • Download data into a pipe delimited file

    I want to download data from an internal table into a pipe delimited file.
    I plan to use FM: SAP_CONVERT_TO_TEX_FORMAT but the system I am working on is BW 3.1.
    This FM does not exists in BW 3.1
    How can I download data from an internal table into a pipe delimited file?
    Please help,
    Thanks,
    CD

    Please use Search before posting, this has been discussed many times already. Not necessarily as "pipe delimited", but delimiter doesn't really matter here. Here is just one of the recent posts:
    Write internal table to file GUI_DOWNLOAD or TRANSFER?
    Note that all GUI functions only work in the foreground. There are also some solutions in "pure ABAP", like looping through the internal table fields and adding a delimiter. Or a quick and dirty solution - define an internal table with the extra fields for delimiters (mainframe legacy!).
    Also questions specific to BW should be posted in the BW forum IMHO, not in ABAP General. Otherwise you'll get a lot of "valuable" suggestions here...

  • How can i import the data from multiple sources into single rpd in obiee11g

    how can i import the data from multiple sources into single rpd in obiee11g

    Hi,
    to import from multiple data sources, first configure ODBC connections for respective data sources. then you can import data from multiple data sources. When you import the data, a connection pool will create automatically.
    tnx

  • Combining Multiple Rows into single row with multple columns

    Hi Experts,
    I have the following requirement, kindly help me.
    I have data in my table like below.
    ID NAME DEPT
    1 Sam 10
    1 Sam 20
    2 alex     30
    2 alex 40
    2 alex 50
    3 vinod 60
    3 vinod 70
    I want to show the same data into single row with dynamically generating columns for DEPT. I want show like below.
    ID NAME DEPT1 DEPT2 DEPT3
    1 Sam 10 20
    2 alex 30 40 50
    3 vinod 60 70
    It's urgent requirement, kindly help me.
    Thanks in advance.

    Right I've had my drink, so what was this "urgent" question then?
    798616 wrote:
    I have data in my table like below.
    ID NAME DEPT
    1 Sam 10
    1 Sam 20
    2 alex     30
    2 alex 40
    2 alex 50
    3 vinod 60
    3 vinod 70
    I want to show the same data into single row with dynamically generating columns for DEPT. I want show like below.Dynamic numbers of columns eh! Tricky.
    If you understand how SQL statements are executed it's along these lines...
    1. Open Cursor
    2. Parse SQL statement and determine columns
    3. Bind in any input values
    4. Fetch data
    5. Bind out values to columns
    6. Repeat step 3 until no more data
    7. Close cursor
    Now, you're expecting that you can determine the columns (step 2) from the fetched data (step 4 onwards). You can't. The SQL engine needs to know the expected columns before any data is fetched so, it can't base the number of columns on the data itself.
    If you need that requirement, you would need to query the data first and build up a dynamic query based on the data and then execute that dynamically built query to fetch the data and pivot it into those columns, which means that you have queried the data twice. Not good practice and not good (or simple) coding.
    What you're talking of doing is something that should be handled at the presentation/interface layer, not as part of the data fetch.
    Typically these sorts of things are handled most easily in report generation/writer tools such as Oracle Reports, Business Objects etc. where they fetch the data from the database and then process it to format it on the display, pivoting the results as required.
    It's not something that lends itself to be easily achieved in SQL. Yes, SQL can do pivoting of data quite easily, but NOT with a dynamic number of columns.
    If you were to specify that there is a maximum number of columns that you could get (rather than wanting it dynamic), then you can do it simply in SQL with the max-decode method...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select deptno, ename, row_number() over (partition by deptno order by ename) as rn from emp)
      2  --
      3  select deptno
      4        ,max(decode(rn,1,ename)) as ename1
      5        ,max(decode(rn,2,ename)) as ename2
      6        ,max(decode(rn,3,ename)) as ename3
      7        ,max(decode(rn,4,ename)) as ename4
      8        ,max(decode(rn,5,ename)) as ename5
      9        ,max(decode(rn,6,ename)) as ename6
    10        ,max(decode(rn,7,ename)) as ename7
    11        ,max(decode(rn,8,ename)) as ename8
    12        ,max(decode(rn,9,ename)) as ename9
    13        ,max(decode(rn,10,ename)) as ename10
    14  from t
    15  group by deptno
    16* order by deptno
    SQL> /
        DEPTNO ENAME1     ENAME2     ENAME3     ENAME4     ENAME5     ENAME6     ENAME7     ENAME8     ENAME9     ENAME10
            10 CLARK      KING       MILLER
            20 ADAMS      FORD       JONES      SCOTT      SMITH
            30 ALLEN      BLAKE      JAMES      MARTIN     TURNER     WARD
    SQL>

  • Concatenation Multiple Rows into Single Row

    My select query is like wise
    ID Name
    1 Arthi
    2 Preethi
    3 Madhu
    4 Saranya
    Above i listed all the names using the select query. Now i have to combine this 4 rows in single row like
    Arthi,Preethi,Madhu,Saranya.
    Also this rows may be 5 or 50 too. So what are Names listed using select statement those should combine into one Single String.
    Help me pl

    Please post this in an appropriate forum;
    SQL and PL/SQL
    PL/SQL
    Community Feedback and Suggestions (Do Not Post Product-Related Questions Here)
    Adith

  • Multiple Row into single Row

    Hi friends,
    I have one table like:
    10 SAM
    10 CAN
    10 MAN
    10 DEV
    20 MAL
    And want output like:
    10 SAM,CAN,MAN,DEV
    20 MAL
    i want to combine multiple rows into one within an existing view.
    What query will suit this to get this type of output.

    Please refer to this thread
    column values separated by ,

  • Convert Rows  into single column

    Hi,
    My employee details table has data like below,
    employee_id position department
    100 technician 50
    100 IT 80
    101 Accountant 60
    101 Accounting Manager 70
    Now i want to covert the rows into column. So my output should be like this.
    output:
    employee_id position department position1 department1
    100 technician 50 IT 80
    101 Accountant 60 Accounting Manager 70
    Help me on this
    Edited by: Vi on Mar 22, 2012 5:36 AM
    Edited by: Vi on Mar 22, 2012 5:36 AM

    Igor.M wrote:
    http:// website link removed /t_converting_rows_columns.htm
    Please don't post links to commercial websites that are only trying to sell their products and services. It breaches the terms of use of the forums.
    There are usually more suitable websites giving much more valuable information without all the self promotion (google adwords etc. are acceptable), or in the case of this particular question there is a FAQ post that relates to it...
    {message:id=9360005}

  • Combine 2 rows into single row?

    I have a table A which has information related to a process. For process completion there exist 2 rows. One has in it the total elapsed time, the time the entire process (which is multipart) begin and end time, but the columns related to rows processed are blank. Another related row has a start, end and elapsed time in it -- which I don't want -- but it has the row counts that I do want.
    I want to take these 2 rows, combine the relevant information into 1 row and insert that row into table B.
    I know I could insert from the first row and then come back and update it from the second row, but I hate having to read Table A twice. Any suggestions?

    Hello
    Is it not just a matter of using group by with sum? I may well have missed an important detail but here's a starting point:
    SQL>    CREATE TABLE DT_TEST_PROCESS
      2  (  id                              number,
      3     stage                   number,
      4     rows_processed  number,
      5     elapsed                 number
      6  )
      7  /
    Table created.
    SQL>
    SQL> INSERT INTO dt_test_process
      2  VALUES(1,1,100,0)
      3  /
    1 row created.
    SQL> INSERT INTO dt_test_process
      2  VALUES(1,2,0,10)
      3  /
    1 row created.
    SQL> INSERT INTO dt_test_process
      2  VALUES(2,1,1000,0)
      3  /
    1 row created.
    SQL> INSERT INTO dt_test_process
      2  VALUES(2,2,0,20)
      3  /
    1 row created.
    SQL>
    SQL> INSERT INTO dt_test_process
      2  VALUES(3,1,500,0)
      3  /
    1 row created.
    SQL> INSERT INTO dt_test_process
      2  VALUES(3,2,0,30)
      3  /
    1 row created.
    SQL>
    SQL> SELECT
      2     id,
      3     SUM(rows_processed) total_rows,
      4     SUM(elapsed) total_elapsed
      5  FROM
      6     dt_test_process
      7  GROUP BY
      8     id
      9  /
            ID TOTAL_ROWS TOTAL_ELAPSED
             1        100            10
             2       1000            20
             3        500            30
    SQL>
    SQL> CREATE TABLE dt_test_process_sum AS
      2  SELECT
      3     id,
      4     SUM(rows_processed) total_rows,
      5     SUM(elapsed) total_elapsed
      6  FROM
      7     dt_test_process
      8  GROUP BY
      9     id
    10  /
    Table created.HTH
    David

  • Convert different rows into single column

    DB : 11.1.0.7
    OS : Solaris Sparc 5.10
    I have one query which is joining few tables and giving me output like below.
    personnum orgnm
    ======= =======
    6     Keyholder
    9     Sales
    3     Mgmt
    I would like to convert that into single column like below.
    col1
    ========
    6,Keyholder,9,Sales,3,Mgmt
    I have tried with pivot and decode, but not getting resule which I am exepcting. Any suggesstions ?

    yashwanth437 wrote:
    listagg() function could work.LISTAGG is not available in 11.1. It was introduced in 11.2.
    Anyway, XML solution:
    with sample_table as (
                          select 6 personnum,'Keyholder' orgnm from dual union all
                          select 9,'Sales' from dual union all
                          select 3,'Mgmt' from dual
    select  rtrim(xmlagg(xmlelement(e,personnum || ',' || orgnm,',').extract('//text()')),',') col1
      from  sample_table
    COL1
    6,Keyholder,9,Sales,3,Mgmt
    SQL> SY.

  • To Combine Multiple STOu2019s into Single Delivery

    Hi,
    What are the configuration settings to be done to combine multiple STOu2019s into one single delivery in VL10B. 
    My requirement is to combine multiple STOu2019s contains different DELIVERY DATES and having SAME SUPPLYING AND RECEIVING PLANT into one single delivery.
    Thanks & Regards,
    Victor.

    Hi
    Delivery in STO is created for single order and for same delivery date, same delivery no. for different delivery date and  for multiple STO is not possible and its not logically correct,since after creation of delivery you will be doing picking and packing and Goods Issue.
    Please check
    Kishor

  • Multiple deliveries into single invoice

    Gurus,
    My business requirement is like this,
    Order is created and delivery process is done with PGI,but the material moves with manual invoice/DC,but the end of the week,all deliveries are compiled into a single invoice  for particular customer.Wheares the header condition,business item remains same.When i tried to put all deliveries for the customer X in vf01 and execute,the individual deliveries cannot be convereted into into single invoice.When split analysis is done it says header is different,but to my knowledge all header ,business items are unique.Kindly help me at this ase

    - Try using Tcode VF04. Opt for delivery related billing active.
    - Select the desired delivery in Billing due list. (Press Ctrl Key from keyboard to select multiple lines).
    - Then you have 2 option
    1. To click on Collective Billing button to do a collective invoice for the selected delv doc.
    2. To analysis whether you will be able to a collective billing or not. To analysis that
    - click on simulation button.
    - Billing Doc Simulate: Billing Doc Overview Screen
    - Select all lines.
    - There first go for Logs, by pressing Log button.
    - Then click on Split Analysis button to get split analysis.
    - If you find any split reason and modify/adjust your copying control accordingly to do combine billing
    - Finally, click on Collective Billing button to do a collective invoice for the selected delv doc.
    Regards
    JP

Maybe you are looking for

  • Performance problems to generate PDF files using CR

    Hi, I develop an application that read TXT files and uses this information to generate PDF files, but I'm having problems with performance to generate this PDF, each files are taking at least 1 minute to create the file. I realized that some TMP and

  • ITunes Match with 2 different apple IDs and crossing 2 devices!

    iTunes is on my PC and accessible thru my apple ID. My partner has a new iPad and it is registered under her apple ID. I have signed up to iTunes Match in the hope that we can access the iTunes library on my PC on her iPad thru iCloud. Is this possib

  • Email Body missing in some emails

    The body of some of my messages is missing. I am using IMAP and everything on the server seems fine. When I look at the raw source I can see the message body as well. I have tried rebuilding my inbox but that has not helped. I have deleted the cache

  • Restrictions Passcode, Help !

    I had a restrictions passcode set on my iPod , however I have forgotten the code and tried the method of using ibackupbot to edit and add the <key>SBParentalControls</key> and under that <string>1234</string>, then restored it, tried 1234 had no luck

  • Did Novell Break Groupwise Install?

    Was trying to do another install today and tried to do everthing in the orginal setup. When it got to groupwise, it started the installer & went on for around an hour. The next time I would look at screen the same window wanting me to install groupwi