Splitting comma seperated column data into multiple rows

Hi Gurus,
Please help me for solving below scenario. I have multiple value in single column with comma seperated values and my requirement is load that data into multiple rows.
Below is the example:
Source Data:
Product         Size                                 Stock
ABC              X,XL,XXL,M,L,S                 1,2,3,4,5,6
Target Data:
Product         Size                                 Stock
ABC              X                                     1
ABC              XL                                   2
ABC              XXL                                 3
ABC              M                                    4
ABC              L                                      5
ABC             S                                        6
Which transformation we need to use for getting this output?
Thanks in advance !

Hello,
Do you need to do this tranformation through OWB mapping only? And can you please tell what type of source you are using? Is it a flat file or a table?
Thanks

Similar Messages

  • Split flat file column data into multiple columns using ssis

    Hi All, I need one help in SSIS.
    I have a source file with column1, I want to split the column1 data into
    multiple columns when there is a semicolon(';') and there is no specific
    length between each semicolon,let say..
    Column1:
    John;Sam;Greg;David
    And at destination we have 4 columns let say D1,D2,D3,D4
    I want to map
    John -> D1
    Sam->D2
    Greg->D3
    David->D4
    Please I need it ASAP
    Thanks in Advance,
    RH
    sql

    Imports System
    Imports System.Data
    Imports System.Math
    Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
    Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
    Imports System.IO
    Public Class ScriptMain
    Inherits UserComponent
    Private textReader As StreamReader
    Private exportedAddressFile As String
    Public Overrides Sub AcquireConnections(ByVal Transaction As Object)
    Dim connMgr As IDTSConnectionManager90 = _
    Me.Connections.Connection
    exportedAddressFile = _
    CType(connMgr.AcquireConnection(Nothing), String)
    End Sub
    Public Overrides Sub PreExecute()
    MyBase.PreExecute()
    textReader = New StreamReader(exportedAddressFile)
    End Sub
    Public Overrides Sub CreateNewOutputRows()
    Dim nextLine As String
    Dim columns As String()
    Dim cols As String()
    Dim delimiters As Char()
    delimiters = ",".ToCharArray
    nextLine = textReader.ReadLine
    Do While nextLine IsNot Nothing
    columns = nextLine.Split(delimiters)
    With Output0Buffer
    cols = columns(1).Split(";".ToCharArray)
    .AddRow()
    .ID = Convert.ToInt32(columns(0))
    If cols.GetUpperBound(0) >= 0 Then
    .Col1 = cols(0)
    End If
    If cols.GetUpperBound(0) >= 1 Then
    .Col2 = cols(1)
    End If
    If cols.GetUpperBound(0) >= 2 Then
    .Col3 = cols(2)
    End If
    If cols.GetUpperBound(0) >= 3 Then
    .Col4 = cols(3)
    End If
    End With
    nextLine = textReader.ReadLine
    Loop
    End Sub
    Public Overrides Sub PostExecute()
    MyBase.PostExecute()
    textReader.Close()
    End Sub
    End Class
    Put this code in ur script component. Before that add 5 columns to the script component output and name them as ID, col1, co2..,col4. ID is of data type int. Create a flat file destination and name it as connection and point it to the flat file as the source.
    Im not sure whats the delimiter in ur flat file between the 2 columns. I have use a comma change it accordingly.
    This is the output I get:
    ID Col1
    Col2 Col3
    Col4
    1 john
    Greg David
    Sam
    2 tom
    tony NULL
    NULL
    3 harry
    NULL NULL
    NULL

  • SharePoint 2013 - Split comma separated Column in to different row items in SharePoint 2013 Workflow or Event Handler

    I have a requirement to take a String column that allows multiple fields i.e. "101;102,103,104",
    and using a SPD 2013 workflow I want to split there values and then insert each Values into different list as separate items.
    Eg:
    I have a LIST A with the columns CustID, CustName and LIST B with the same Column Name with the below values
    LIST A:
    Cust ID
    CustName
    101
    ABC, XYZ, CTSS, WIPROS, TCSS
    I want to insert the above comma separated values in the below format(different Row)
    LIST B:
    CustID
    CustName
    101
    ABC
    101
    XYZ
    101
    CTSS
    101
    WIPROS
    101
    TCSS

    Hi,
    Here is a codeplex solution can meet your reference:
    Plumsail String Workflow Actions for SharePoint 2013 and SharePoint Online
    http://spworkflowactions.codeplex.com/
    We can use Split string workflow action to split the CustName value, then insert it to ListB.
    More information:
    http://www.codeproject.com/Articles/749471/String-processing-workflow-actions-for-SharePoint
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Split the data into multiple  rows in table

    Hello,
    I am using Oracle 10g apex 3.2.
    I have a requirement like this.
    I have a table like TableA
    Col1 Col2
    90 1
    91 1:2:3
    92 3
    I want the data like
    Col1 Col2
    90 1
    91 1
    91 2
    91 3
    92 3
    How to do this?
    Thanks
    Edited by: user13305573 on Aug 3, 2010 8:16 PM

    with
       your_data as
       select 90 as col1, '1'  as col2      from dual union all
       select 91, '1:2:3'   from dual union all
       select 92, '3'       from dual
    select
       y.col1,   
       regexp_substr(y.col2, '[^:]+', 1, t1.column_value) as col2
    from
       your_data y,
    13     table(cast(multiset(select level from dual connect by  level <= length (regexp_replace(y.col2, '[^:]+'))  + 1) as sys.OdciNumberList)) t1
    14  /
                  COL1 COL2
                    90 1
                    91 1
                    91 2
                    91 3
                    92 3
    5 rows selected.
    Elapsed: 00:00:00.05
    ME_XE?select * from v$version;
    BANNER
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE     10.2.0.1.0     Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    5 rows selected.
    Elapsed: 00:00:00.03
    ME_XE?

  • Convert comma separated to string into multiple row

    Hi,
    I have SQL query which will fetch the data like below.
    {code}
    ID     NAME     CODE
    1     A,B          5,2
    2     X              10
    3     Z               4
    {code}
    So now i have to split the data like below
    {code}
    ID     NAME     CODE
    1     A               5
    1     B               2
    2     X              10
    3     Z               4
    {code}

    https://forums.oracle.com/thread/2549548

  • Procedure to insert data in multiple rows

    Hi,
    I need a stored procedure which inserts data into multiple rows..
    Ex: I need to have 3 columns in Procedure, where col3 has limit in size let's say 500.
    If user insert about 1500 in col3, i has to insert first 500 in row1 and 501 - 1000 in row 2 and 1001 - 1500 in row 3.
    Can any one help in creating procedure for above scenario.
    Thanks in Advance...
    Sree

    create table #t (id int, id1 int)
    WITH [1-20]
    AS
    SELECT row_number() over (order by number) rn,number
            FROM master..spt_values
             WHERE type = 'P'
             AND number BETWEEN 1 AND 20
     [21-30]
    AS
    SELECT row_number() over (order by number) rn,number
            FROM master..spt_values
             WHERE type = 'P'
             AND number BETWEEN 21 AND 30
    ) INSERT INTO #t 
      SELECT A.number,B.number FROM
         [1-20] A JOIN [21-30] B ON A.rn=B.rn
    SELECT * FROM #t
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Interactive report – column heading in multiple rows

    I am using interactive report. My question to the expert/guru&rsquo;s is: - How do I change column heading into multiple row with text wrap.
    For example:- My column heading is
    Is Employee Trained ? -------&gt; (single row display)
    I want to make it display like
    Is Employee
    Trained ? ------&gt; (Multi row display)
    Sagar

    Hi,
    What you could do is, disable the download csv function from IR (Interactive Report Attributes--> Search Bar-- Uncheck Download) and in the region header create a link and redirect it to another page which will have the csv report output.
    e.g. <a href="#"  onclick="javascript:redirect('f?p=&APP_ID.:3:&SESSION.::&DEBUG.:3::');"" >Download Report </a>
    Here I am redirecting the link to Page 3. On Page 3 create a sql report with the same query and make report template to csv. Thanks,
    Manish

  • Collecting data from multiple rows into one column

    I'd like to run a query and put a collection of items into one output column instead of multiple rows. See the example below:
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Prod
    PL/SQL Release 10.2.0.5.0 - Production
    "CORE     10.2.0.5.0     Production"
    TNS for 32-bit Windows: Version 10.2.0.5.0 - Production
    NLSRTL Version 10.2.0.5.0 - Production
         CREATE TABLE "SKIP"."INGREDIENTS"
       (     "INGRED_ID" NUMBER,
         "INGRED_NAME" VARCHAR2(20 BYTE),
         "STORES" VARCHAR2(20 BYTE)
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" ;
    REM INSERTING into SKIP.INGREDIENTS
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (1,'SEA SALT','Food lion');
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (2,'TABLE SALT','Food lion');
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (3,'FLOUR','Piggly Wiggly');
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (4,'YEAST',null);
    Insert into SKIP.INGREDIENTS (INGRED_ID,INGRED_NAME,STORES) values (5,'BEER','ABC Store');
      CREATE TABLE "SKIP"."PRETZELS"
       (     "PRETZEL_ID" NUMBER,
         "PRETZEL_NAME" VARCHAR2(20 BYTE),
         "PRETZEL_DESC" VARCHAR2(100 BYTE)
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" ;
    REM INSERTING into SKIP.PRETZELS
    Insert into SKIP.PRETZELS (PRETZEL_ID,PRETZEL_NAME,PRETZEL_DESC) values (1,'CLASSIC','Classic knot pretzel');
    Insert into SKIP.PRETZELS (PRETZEL_ID,PRETZEL_NAME,PRETZEL_DESC) values (2,'THICK STICK','Straight pretzel, abt 1/2" in dia');
      CREATE TABLE "SKIP"."INGRED_XREF"
       (     "PRETZEL_ID" NUMBER,
         "INGRED_ID" NUMBER
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS" ;
    REM INSERTING into SKIP.INGRED_XREF
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (1,1);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (1,2);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (1,4);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (2,2);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (2,3);
    Insert into SKIP.INGRED_XREF (PRETZEL_ID,INGRED_ID) values (2,5);
    --  Constraints for Table INGRED_XREF
      ALTER TABLE "SKIP"."INGRED_XREF" MODIFY ("PRETZEL_ID" NOT NULL ENABLE);
      ALTER TABLE "SKIP"."INGRED_XREF" MODIFY ("INGRED_ID" NOT NULL ENABLE);
    {code}
    Desired output (note how the ingredients are all listed in one column, separated by commas):
    {code}
    PRETZEL_ID PRETZEL_NAME     PRETZEL_DESC                        INGREDIENTS
    1          CLASSIC          Classic knot pretzel                SEA SALT, TABLE SALT, YEAST
    2          THICK STICK      Straight pretzel, abt 1/2" in dia   TABLE_SALT, FLOUR, BEER

    See the FAQ : {message:id=9360005}
    Especially links concerning string aggregation.

  • How to spool data into multiple Excel sheet if result is more then 65k rows

    Hi all,
    Wann spool data into multiple excel sheet bocz my resultant no of rows are more then 65k.
    Thanks to all in advance.....

    many choices
    1) migrate to a newer version of Excel
    2) split the files after spooling
    for instance with split
    split -l65000 file.txtor with perl, java, vb or what-so-ever
    3) do more than one report by using rownum
    spool f1
    select empno,ename  from (select rownum r,empno,ename from emp order by empno) where r<6 ;
    spool off
    spool f2
    select empno,ename  from (select * from (select rownum r,empno,ename from emp order by empno) where r<11) where r>5 ;
    spool off
    spool f3
    select empno,ename  from (select rownum r,empno,ename from emp order by empno) where r>10 ;
    spool off

  • Easy Question: How to split concatenated string into multiple rows?

    Hi folks,
    this might be an easy question.
    How can I split a concatenated string into multiple rows using SQL query?
    INPUT:
    select 'AAA,BBB,CC,DDDD' as data from dualDelimiter = ','
    Expected output:
    data
    AAA
    BBB
    CCC
    DDDDI'm looking for something kind of "an opposite for 'sys_connect_by_path'" function.
    Thanks,
    Tomas

    Here is the SUBSTR/INSTR version of the solution:
    SQL> WITH test_data AS
      2  (
      3          SELECT ',' || 'AAA,BBB,CC,DDDD' || ',' AS DATA FROM DUAL
      4  )
      5  SELECT  SUBSTR
      6          (
      7                  DATA
      8          ,       INSTR
      9                  (
    10                          DATA
    11                  ,       ','
    12                  ,       1
    13                  ,       LEVEL
    14                  ) + 1
    15          ,       INSTR
    16                  (
    17                          DATA
    18                  ,       ','
    19                  ,       1
    20                  ,       LEVEL + 1
    21                  ) -
    22                  INSTR
    23                  (
    24                          DATA
    25                  ,       ','
    26                  ,       1
    27                  ,       LEVEL
    28                  ) - 1
    29          )       AS NEW_STRING
    30  FROM    test_data
    31  CONNECT BY LEVEL <= LENGTH(REGEXP_REPLACE(DATA,'[^,]','')) - 1
    32  /
    NEW_STRING
    AAA
    BBB
    CC
    DDDD

  • How To Concatenate Column Values from Multiple Rows into a Single Column?

    How do I create a SQL query that will concatenate column values from multiple rows into a single column?
    Last First Code
    Lesand Danny 1
    Lesand Danny 2
    Lesand Danny 3
    Benedi Eric 7
    Benedi Eric 14
    Result should look like:
    Last First Codes
    Lesand Danny 1,2,3
    Benedi Eric 7,14
    Thanks,
    David Johnson

    Starting with Oracle 9i
    select last, first, substr(max(sys_connect_by_path(code,',')),2) codes
    from
    (select last, first, code, row_number() over(partition by last, first order by code) rn
    from a)
    connect by last = prior last and first = prior first and prior rn = rn -1
    start with rn = 1
    group by last, first
    LAST       FIRST      CODES                                                                                                                                                                                                  
    Lesand         Danny          1,2,3
    Benedi         Eric           7,14Regards
    Dmytro

  • Split single row into multiple rows containing time periods

    Hi,
    I have a table with rows like this:
    id, intime, outtime
    1, 2010-01-01 00:10, 2010-01-3 20:00
    I would like to split this row into multiple rows, 1 for each 24hr period in the record.
    i.e. The above should translate into:
    id, starttime, endtime, period
    1, 2010-01-01 00:10, 2010-01-02 00:10, 1
    1, 2010-01-02 00:10, 2010-01-03 00:10, 2
    1, 2010-01-03 00:10, 2010-01-03 20:00, 3
    The first starttime should be the intime and the last endtime should be the outtime.
    Is there a way to do this without hard-coding the 24hr periods?
    Thanks,
    Dan Scott
    http://danieljamesscott.org

    Thanks for all the feedback, Dan.
    It appears that the respective solutions provided will give you: a) different resultsets and b) different performance.
    Regarding your 'truly desired resultset' you haven't answered all questions from my previous post (there are differences in the provided examples), but anyway:
    I found that using CEIL or ROUND makes quite a difference, using my 'simple 3 record testset' (30 records vs. 66 records got initially returned, that's less than half of the original). That's quite a difference. However, I must call it a day (since it's almost midnight) for now, so there's room for more optimizement and I haven't thoroughly tested.
    But this might hopefully make a difference performancewise when compared to my previous 'dreaded example':
    SQL> drop table t;
    Table dropped.
    SQL> create table  t as
      2  select 1 id, to_date('2010-01-01 00:10', 'yyyy-mm-dd hh24:mi') intime, to_date('2010-01-03 20:00', 'yyyy-mm-dd hh24:mi') outtime from dual union all
      3  select 2 id, to_date('2010-02-01 00:10', 'yyyy-mm-dd hh24:mi') intime, to_date('2010-02-05 20:00', 'yyyy-mm-dd hh24:mi') outtime from dual union all
      4  select 3 id, to_date('2010-03-01 00:10', 'yyyy-mm-dd hh24:mi') intime, to_date('2010-03-03 00:10', 'yyyy-mm-dd hh24:mi') outtime from dual;
    Table created.
    SQL> select id
      2  ,      max(intime)+level-1 starttime
      3  ,      case
      4           when level = to_char(max(t.outtime), 'dd')
      5           then max(t.outtime)
      6           else max(t.intime)+level
      7         end outtime
      8  ,      level period      
      9  from   t
    10  connect by level <= round(outtime-intime)
    11  group by id, level
    12  order by 1,2;
            ID STARTTIME           OUTTIME                 PERIOD
             1 01-01-2010 00:10:00 02-01-2010 00:10:00          1
             1 02-01-2010 00:10:00 03-01-2010 00:10:00          2
             1 03-01-2010 00:10:00 03-01-2010 20:00:00          3
             2 01-02-2010 00:10:00 02-02-2010 00:10:00          1
             2 02-02-2010 00:10:00 03-02-2010 00:10:00          2
             2 03-02-2010 00:10:00 04-02-2010 00:10:00          3
             2 04-02-2010 00:10:00 05-02-2010 00:10:00          4
             2 05-02-2010 00:10:00 05-02-2010 20:00:00          5
             3 01-03-2010 00:10:00 02-03-2010 00:10:00          1
             3 02-03-2010 00:10:00 03-03-2010 00:10:00          2
    10 rows selected.
    SQL> By the way: I'm assuming you're on 10g, is that correct?
    Can you give us some information regarding the indexes present on your table?

  • I need to divide selected row into multiple rows when i navigate  ADF 11g

    Hi
    I'm using jdeveloper 11.1.1.2.0 with ADF 11g.
    I need to divide selected row into multiple rows when i navigate to other page . Scenario - in first page i'm displaying some records with columns like empno , empstatus , empworkdepts ,curdepts
    Here empworkdepts gives the numeric number like no of departments work shifts 3 or 4 or 5. when i select any particular employee and fire next button to navigate next page.I have to divide the selected employee with same information into multiple times based on the empworkdepts value.
    empno empstatus empworkdepts curdept
    001 eds 2 TS
    002 hr 1 FO
    003 eds 4 TS
    *004 eds 3 TS*
    now i selected employee 004 , when i navigate to next page.
    Empno EmpStatus EmpWorkDepts CurDept
    004 eds 3 TS
    004 eds 3 TS
    004 eds 3 TS
    i did with java code in bean .but not stable .
    any help............
    thanks advance.............
    Edited by: user9010551 on May 5, 2010 10:48 PM
    Edited by: user9010551 on May 10, 2010 11:31 PM

    user9086775 wrote:
    Hi Experts,
    I have a requirment where i need to fetch parts of a single row into multiple rows from a singlt Query, i am sure it is possible using Pivots but just cant figure out an approach. Any help on this is highly appriciapted.
    Requirment:
    This is a sample set record in a table
    Product     Sub Product          Name    Age
    New Car    Nissan                   Tom        49
    New Car    Nissan                   Jack         36
    Old Car      Audi                     Sam         24
    Old Car      Jaguar                  Pint          26
    Old Car      Audi                     Smith       41
    I need to be able to fetch the above data in the below fashion
    Product     Sub Product          Name    Age
    New Car
    Nissan
    Tom        49
    Jack        36
    Old Car     
    Audi            
    Sam        24
    Smith      41
    Jaguar                   Pint         26Please help with ideas as to how can i achive the above without using PLSQL.
    Thanks in advance!You should be doing this in the client on not in the DB. Use the reporting tool that you use to do this.
    For example if you are in SQL Plus you can use the BREAK command.

  • Alternative way to fetch the data into single row.

    we have a query
    SELECT COLUMN_NAME FROM USER_TAB_COLUMNS WHERE TABLE_NAME='XXX';
    This query will return the data in multiple rows.
    May know the alternative way to retrieve all the multiple rows in **single row with each row as a seperate column**.

    Why specifically an array - and do you want the SQL projection as an array, or collect the SQL projection into an array?
    E.g.
    SQL> create or replace type TStrings is table of varchar2(4000);
      2  /
    Type created.
    SQL> --// SQL projection casted into an array
    SQL> select
      2          cast(
      3                  MultiSet(
      4                          select column_name from all_tab_columns where table_name = 'KU$_DATAPUMP_MASTER_11_2' and owner = 'SYS'
      5                  )
      6                  as TStrings
      7          )                       as COLUMN_ARRAY
      8  from       dual
      9  /
    COLUMN_ARRAY
    TSTRINGS('REMOTE_LINK', 'VERSION', 'JOB_VERSION', 'DB_VERSION', 'TIMEZONE', 'STATE', 'PHASE', 'GUID', 'START_TIME', 'BLOCK_SIZE', 'METADATA_BUFFER_SIZE', 'DATA_BUFFER_SIZE', 'DEGREE', 'PLATFORM', 'ABO
    RT_STEP', 'INSTANCE', 'CLUSTER_OK', 'SERVICE_NAME', 'OBJECT_INT_OID', 'PROCESS_ORDER', 'DUPLICATE', 'DUMP_FILEID', 'DUMP_POSITION', 'DUMP_LENGTH', 'DUMP_ORIG_LENGTH', 'DUMP_ALLOCATION', 'COMPLETED_ROW
    S', 'ERROR_COUNT', 'ELAPSED_TIME', 'OBJECT_TYPE_PATH', 'OBJECT_PATH_SEQNO', 'OBJECT_TYPE', 'IN_PROGRESS', 'OBJECT_NAME', 'OBJECT_LONG_NAME', 'OBJECT_SCHEMA', 'ORIGINAL_OBJECT_SCHEMA', 'ORIGINAL_OBJECT
    _NAME', 'PARTITION_NAME', 'SUBPARTITION_NAME', 'DATAOBJ_NUM', 'FLAGS', 'PROPERTY', 'TRIGFLAG', 'CREATION_LEVEL', 'COMPLETION_TIME', 'OBJECT_TABLESPACE', 'SIZE_ESTIMATE', 'OBJECT_ROW', 'PROCESSING_STAT
    E', 'PROCESSING_STATUS', 'BASE_PROCESS_ORDER', 'BASE_OBJECT_TYPE', 'BASE_OBJECT_NAME', 'BASE_OBJECT_SCHEMA', 'ANCESTOR_PROCESS_ORDER', 'DOMAIN_PROCESS_ORDER', 'PARALLELIZATION', 'UNLOAD_METHOD', 'LOAD
    _METHOD', 'GRANULES', 'SCN', 'GRANTOR', 'XML_CLOB', 'PARENT_PROCESS_ORDER', 'NAME', 'VALUE_T', 'VALUE_N', 'IS_DEFAULT', 'FILE_TYPE', 'USER_DIRECTORY', 'USER_FILE_NAME', 'FILE_NAME', 'EXTEND_SIZE', 'FI
    LE_MAX_SIZE', 'PROCESS_NAME', 'LAST_UPDATE', 'WORK_ITEM', 'OBJECT_NUMBER', 'COMPLETED_BYTES', 'TOTAL_BYTES', 'METADATA_IO', 'DATA_IO', 'CUMULATIVE_TIME', 'PACKET_NUMBER', 'INSTANCE_ID', 'OLD_VALUE', '
    SEED', 'LAST_FILE', 'USER_NAME', 'OPERATION', 'JOB_MODE', 'QUEUE_TABNUM', 'CONTROL_QUEUE', 'STATUS_QUEUE')
    SQL> --// collecting the SQL projection as an array
    SQL> declare
      2          colArray        TStrings;
      3  begin
      4          select
      5                  column_name bulk collect into colArray
      6          from    all_tab_columns
      7          where   table_name = 'KU$_DATAPUMP_MASTER_11_2'
      8          and     owner = 'SYS';
      9 
    10          --// process array
    11  end;
    12  /
    PL/SQL procedure successfully completed.
    SQL>

  • Please - immediate help needed parsing csv values into multiple rows

    Hello, we have a very immediate need to be able to parse out a field of comma separated values into individual rows. The following is an example written in SQL Server syntax which does not work in Oracle.
    The tricky part is that each ROUTES can be a different length, and each CSV can have a different number of routes in it.
    Here is an example of the table ("Quotes") of CSV values I want to normalize:
    TPNUMBER ROUTES
    1001 1, 56W, 18
    1002 2, 16, 186, 28
    Here is an example of what I need it to look like:
    TPNUMBER ROUTES
    1001 1
    1001 56W
    1001 18
    1002 2
    1002 16
    1002 186
    1002 28
    Here is the "Tally" table for the query below:
    ID
    1
    2
    3
    4
    5
    6
    7
    And finally, here is the query which parses CSV values into multiple rows but which does not work in Oralce:
    SELECT TPNUMBER,
    NullIf(SubString(',' + ROUTES + ',' , ID , CharIndex(',' , ',' + ROUTES + ',' , ID) - ID) , '') AS ONEROUTE
    FROM Tally, Quotes
    WHERE ID <= Len(',' + ROUTES + ',') AND SubString(',' + Phrase + ',' , ID - 1, 1) = ','
    AND CharIndex(',' , ',' + ROUTES + ',' , ID) - ID > 0
    It may be necessary to use a cursor to loop through the CSV table and process each row (a loop within another loop...) but this is beyond my comprehesion of PL/SQL.
    Many thanks in advance for your advice/help.
    apk

    Not sure what you are trying to do with the last step, but this should work for the first part. I assume you would use sqlldr but I just did inserts instead. You might need more than 5 "routes" in the csv. You could put some reasonable max on that number of columns:
    SQL>create table t_csv
    2 (TPNUMBER varchar2(20),
    3 ROUTE_1 VARCHAR2(5),
    4 ROUTE_2 VARCHAR2(5),
    5 ROUTE_3 VARCHAR2(5),
    6 ROUTE_4 VARCHAR2(5),
    7 ROUTE_5 VARCHAR2(5),
    8 ROUTE_6 VARCHAR2(5) );
    Table created.
    SQL>INSERT INTO t_csv (TPNUMBER,ROUTE_1,ROUTE_2) values( '1001 1', '56W', '18' );
    1 row created.
    SQL>INSERT INTO t_csv (TPNUMBER,ROUTE_1,ROUTE_2,ROUTE_3) values( '1002 2', '16', '186', '28');
    1 row created.
    SQL>create table t_quotes(
    2 tpnumber NUMBER,
    3 routes VARCHAR2(5));
    Table created.
    SQL>DECLARE
    2 L_tpnumber NUMBER;
    3 L_route VARCHAR2(5);
    4 begin
    5 for rec in (select * from t_csv) loop
    6 L_tpnumber := SUBSTR(rec.tpnumber,1,INSTR(rec.tpnumber,' ')-1);
    7 L_route := SUBSTR(rec.tpnumber,INSTR(rec.tpnumber,' ')+1);
    8 insert into t_quotes values( L_tpnumber, l_route );
    9 if rec.route_1 is not null then
    10 insert into t_quotes values( L_tpnumber, rec.route_1 );
    11 end if;
    12 if rec.route_2 is not null then
    13 insert into t_quotes values( L_tpnumber, rec.route_2 );
    14 end if;
    15 if rec.route_3 is not null then
    16 insert into t_quotes values( L_tpnumber, rec.route_3 );
    17 end if;
    18 if rec.route_4 is not null then
    19 insert into t_quotes values( L_tpnumber, rec.route_4 );
    20 end if;
    21 if rec.route_5 is not null then
    22 insert into t_quotes values( L_tpnumber, rec.route_5 );
    23 end if;
    24 end loop;
    25 end;
    26 /
    PL/SQL procedure successfully completed.
    SQL> select tpnumber, routes from t_quotes;
    TPNUMBER ROUTE
    1001 1
    1001 56W
    1001 18
    1002 2
    1002 16
    1002 186
    1002 28
    7 rows selected.

Maybe you are looking for

  • How to reset junk mailbox message count?

    Apologies if this is resolved elsewhere, but I can't find it. For the past several months I have received several "ghost" spams per day. (There is nothing in the sender, message header, or body.) The mail filter does not catch them. I wrote a rule (b

  • How to enable instant messaging in Nokia E72?

    Hello, As per Nokia E72 user guide, the phone does support IM(Instant Messaging). However I am not able to locate it? Could someone help me with IM set up? Thanks venks

  • How to count Command-Line Arguments ?

    How do you count Command-Line Arguments ? For example, java program argument1 arguement2 I would like to be able to count how many arguements the user inputed It should result as 2 for the bold line above Thank you for your help

  • Very slow imaging

    Hello I've got a problem with my multicast sessions. When i start an multicast session, and it begins with imaging, it really is slow, it takes 75 minutes to image a pc, with Ghost it only takes 5 to 6 minutes. I'm using the normal Boot.ISO file beca

  • Dual 27" Thunderbolt Displays on 13" MacBook Pro Retina

    I'm thinking of buying two Thunderbolt Displays and make my 13" MacBook Pro Retina my main desktop computer. So the question is:Can the 13" MBP handle two chained Thunderbolt Displays without getting slower or will the Intel HD 4000 just melt down? I