10GR2 - How can I load multiple row values into one field?

Hi
Can anyone please help with a problem I'm having with merging data.
The source table has multiple entries for the same Id e,g,
ID Code
1 123
1 234
2 123
2 567
The output should only have one row per ID e.g.
ID Code_List
1 123;234
2 123;567
Do you know what operator I could use that would allow me to do this? I've looked at unpivot but I think I would need multiple output fields (one for each Code). I have to concatinate the codes and separate with a semi-colon.
Thanks
GB

Q) Input data
=============
COL_0,COL_4
1235,"G0123,G124,G25,G6"
1236,"G01,G23,G124,G25,G6"
1237,"G0123,G1,G24,G25,G6"
1238,"G,G0123,G124,G25,G6"
1239,"G0123124,G256"
Output
======
TEST_ID,TEST_VAL
1235,G0123
1235,G124
1235,G25
1235,G6
1236,G01
1236,G23
1236,G124
1236,G25
1236,G6
1237,G0123
1237,G1
1237,G24
1237,G25
1237,G6
1238,G
1238,G0123
1238,G124
1238,G25
1238,G6
1239,G0123124
1239,G256
I wrote this procedure...
declare
rcd_cnt number;
test_id123 number;
junk_1 number;
cd_occurences number;
child_count number;
str_abc varchar2(200);
char_pos     number default 0;
cd_temp_str varchar2(50);--:= 'G0123,G124,G25,G6';
begin
select nvl(count(col_4),0) into rcd_cnt from test_ee where col_4 is not null;
for aa in 1 .. rcd_cnt loop
select col_0,rownum rn,nvl(trim(col_4),0) into test_id123,junk_1,cd_temp_str from (select col_0,rownum rn,col_4 from test_ee where col_4 is not null) where rn = aa;
--dbms_output.put_line('...I am in for loop...' || cd_temp_str);
     --dbms_output.put_line('===================' || rcd_cnt || '.................' ||aa);
cd_occurences := length(cd_temp_str) - length(replace(cd_temp_str,','));
dbms_output.put_line(cd_temp_str || '...Str Occurences are ...'||cd_occurences ||'**************'||test_id123);
child_count :=0;
for z in 1..length(cd_temp_str)+1 loop
child_count := child_count+1;
     if(instr(cd_temp_str,',') > 0) then
     char_pos := instr(cd_temp_str,',',1,1);
          str_abc := substr(cd_temp_str,1,char_pos-1);
     dbms_output.put_line('..Partial String of..'|| z ||'..is.....' || str_abc);
          insert into test_xx(test_id,test_val) values(test_id123,str_abc);
     end if;
     cd_temp_str := substr(cd_temp_str,char_pos+1,length(cd_temp_str));
     if(cd_occurences=child_count) then
     dbms_output.put_line('..Partial String of..is.....' || cd_temp_str);
          insert into test_xx(test_id,test_val) values(test_id123,cd_temp_str);
     end if;     
end loop; -- close for of z */
--dbms_output.put_line('...I am in end for loop...');
     end loop; -- close for of aa
end;
instead of procedure,is there any way from sqlqery.

Similar Messages

  • Multiple Checkbox Values Into One Field

    Hopefully someone can help me with this issue I'm having.
    I'm trying to save the values of multiple selected checkboxes into one field separated by commas through ADDT's Insert Transaction code. I can do this easily with DW's standard insert record wizard by using the PHP implode() function but I haven't been able to figure it out with ADDT's code.
    <form>
    <input type="checkbox" value="1" name="program[]" /> Program One
    <input type="checkbox" value="2" name="program[]" /> Program Two
    <input type="checkbox" value="3" name="program[]" /> Program Three
    <input type="checkbox" value="4" name="program[]" /> Program Four
    </form>
    THIS IS ADDT'S CODING
    $ins_quoteManager->addColumn("programs", "STRING_TYPE",  "POST", "programs");
    THIS WORKS VIA DREAMWEAVER'S INSERT RECORD WIZARD
    Original: GetSQLValueString($_POST['programs'], "text"),
    Modified: GetSQLValueString(implode(',',$_POST['programs']), "text"),
    Anyone know how to modify the ADDT code with the implode function to get this to work?

    Have you tried ADDT´s "comma-separated checkboxes" form control, which will also store the values into a field of your choice (and of course retrieve them from there on update record - pages) ? The only possible drawback might be, that the checkboxes can´t be defined statically, means that the array of value/label - pairs will be retrieved from another table by establishing an additional recordset.
    Cheers,
    Günter

  • How can you combine multiple PDF pages into one searchable PDF page?

    I have scanned multiple business cards and now have a PDF  file with over 500 pages (or cards). I would like to be able and create a  page with 8 cards to a page and is still searchable for text. Right now, the text is searchable. Basically have 63 pages and not 500.
    Example:
    If I wanted to find Joe Smith's card, I could search for  "Joe Smith" and it would search all of the text and bring me to the  page(s). Right now, it will bring me to that page. Is there a way to create  a page where I can have multiple cards and the text is still searchable?
    I tried to create a page in Photoshop, made 8 different layers with 8  different cards, but when saved, not only was the file way too large, but no text, or font, was detected  and there was nothing to  search for.
    Is there an option to create a page in Acrobat Professional and put 8 cards to a page?
    I have InDesign, Illustrator, Photoshop and Acrobat Professional Pro.
    Thanks,
    mr19th

    That sounds great, but I'm lost.
    I followed these steps:
    1) Open your PDF (in Adobe Acrobat Pro)
    2) Chose print
    The print/printer options pop-up will show.
    3) In the printer section, do not use your normal printer, a printer named Adobe PDF should be an option. Chose it.
    4) Under the "Page handling" section, change the Page Scaling drop-down menu to "Multiple pages per sheet".
    It works fine, but it looses all of the font information and the search no longer works. How can you do it and save the font info, so the search tool continues to operate.
    Am I missing anything?

  • How can I combine multiple Pages documents into one using iPad?

    Hello all,
    I have created a magazine with my students using pages. The problem is that each article is a separate documents. Now I have to put them all together. How can I do that, using iPad? Is it even possible?
    Thank you

    copy paste is the only way to do it on a pad - document by document.

  • HT2486 how can I import multiple address books into one. . . . ?

    I have two laptops with different Address Books, I want to merge them into one on a new macbook pro. I can only import one archive file, otherwise it will overwrite the other one. . . . or so it says. . . suggestions?

    Export the one you want to move to a vCard file (select all contacts) then import to the one you want it to be in.

  • How can I Convert Multiple Music tracks into one track or file

    I Have Mix Cd's with multiple tracks on them,,,,,,,,I am trying to Convert these tracks into one Track,,,,,,is this process possible thru Itunes or do I need to buy a software for this,,,,,,I see there is a Join Cd Tracks button but it is not highlighted for me to select it,,,,,,,,PLEASE HELP,,,,,,THANKS

    Can anyone help?

  • How can i merge multiple scanned documents into one document?

    Can anyone help me with this.  I need to email the document as one and not individual pages, not very professional!

    Choose the combine files otion on the star screen.
    Mylenium

  • How can you merge multiple daily backups into one backup for that day?

    Ok, so I had some trouble getting Time Machine to backup some new files and finally had a force a "deep traversal." But now I have 20+ backups for today before I did the "deep traversal" because I was selecting "Back Up Now" to get it to backup up the new files.
    Because it is annoying to have so many backups for one day, which differ only by incoming and outgoing emails, I am wanting to combine all the backups for today into a single backup for today. Is there any way to do this?
    Thanks!

    BibbleBobble wrote:
    Because it is annoying to have so many backups for one day, which differ only by incoming and outgoing emails, I am wanting to combine all the backups for today into a single backup for today. Is there any way to do this?
    Yes. Wait 24 hours, and Time Machine will do it for you. It keeps all backups for 24 hours, but only one (the first of the day) for a month. Thereafter, it keeps one per week, deleting the others, as long as there's room. See #12 in [Time Machine - Frequently Asked Questions|http://web.me.com/pondini/Time_Machine/FAQ.html] (or use the link in *User Tips* at the top of this forum).

  • How can I use multiple row insert or update into DB in JSP?

    Hi all,
    pls help for my question.
    "How can I use multiple rows insert or update into DB in JSP?"
    I mean I will insert or update the multiple records like grid component. All the data I enter will go into the DB.
    With thanks,

    That isn't true. Different SQL databases have
    different capabilities and use different syntax, That's true - every database has its own quirks and extensions. No disagreement there. But they all follow ANSI SQL for CRUD operations. Since the OP said they wanted to do INSERTs and UPDATEs in batches, I assumed that ANSI SQL was sufficient.
    I'd argue that it's best to use ANSI SQL as much as possible, especially if you want your JDBC code to be portable between databases.
    and there are also a lot of different ways of talking to
    SQL databases that are possible in JSP, from using
    plain old java.sql.* in scriptlets to using the
    jstlsql taglib. I've done maintenance on both, and
    they are as different as night and day.Right, because you don't maintain JSP and Java classes the same way. No news there. Both java.sql and JSTL sql taglib are both based on SQL and JDBC. Same difference, except that one uses tags and the other doesn't. Both are Java JDBC code in the end.
    Well, sure. As long as you only want to update rows
    with the same value in column 2. I had the impression
    he wanted to update a whole table. If he only meant
    update all rows with the same value in a given column
    with the same value, that's trivial. All updates do
    that. But as far as I know there's know way to update
    more than one row where the values are different.I used this as an example to demonstrate that it's possible to UPDATE more than one row at a time. If I have 1,000 rows, and each one is a separate UPDATE statement that's unique from all the others, I guess I'd have to write 1,000 UPDATE statements. It's possible to have them all either succeed or fail as a single unit of work. I'm pointing out transaction, because they weren't coming up in the discussion.
    Unless you're using MySQL, for instance. I only have
    experience with MySQL and M$ SQL Server, so I don't
    know what PostgreSQL, Oracle, Sybase, DB2 and all the
    rest are capable of, but I know for sure that MySQL
    can insert multiple rows while SQL Server can't (or at
    least I've never seen the syntax for doing it if it
    does).Right, but this syntax seems to be specific to MySQL The moment you use it, you're locked into MySQL. There are other ways to accomplish the same thing with ANSI SQL.
    Don't assume that all SQL databases are the same.
    They're not, and it can really screw you up badly if
    you assume you can deploy a project you've developed
    with one database in an environment where you have to
    use a different one. Even different versions of the
    same database can have huge differences. I recommend
    you get a copy of the O'Reilly book, SQL in a
    Nutshell. It covers the most common DBMSes and does a
    good job of pointing out the differences.Yes, I understand that.
    It's funny that you're telling me not to assume that all SQL databases are the same. You're the one who's proposing that the OP use a MySQL-specific extension.
    I haven't looked at the MySQL docs to find out how the syntax you're suggesting works. What if one value set INSERT succeeds and the next one fails? Does MySQL roll back the successful INSERT? Is the unit of work under the JDBC driver's control with autoCommit?
    The OP is free to follow your suggestion. I'm pointing out that there are transactions for units of work and ANSI SQL ways to accomplish the same thing.

  • Concatenate multiple row values into single column value

    Hello,
    Can anyone please refresh my memory on how to concatenate multiple row values into a single column value.
    In the following query, I will get multiple denial reasons per application and I would rather return all denial reasons on one line.
    SELECT a.application_id, a.membership_number,
    r.reason_text AS denial_reason,
    a.appl_receipt_date AS application_receipt_date,
    a.plan_request_1 AS application_plan_code,
    a.adjudication_date AS application_denial_date
    FROM application a, PLAN p, application_reason ar, reason r
    WHERE a.plan_request_1 = p.plan_cd
    AND a.application_id = ar.application_id
    AND ar.reason_id = r.reason_id
    AND a.adjudication_cd = 'D'
    AND a.appl_receipt_date BETWEEN '01-jan-2006' AND '31-dec-2006'
    AND p.plan_type_id = 12 and a.application_id = :appId
    ORDER BY application_id
    Any help is greatly appreciated.
    Thanks,
    -Christine

    found the following
    SELECT deptno,
           LTRIM(MAX(SYS_CONNECT_BY_PATH(ename,','))
           KEEP (DENSE_RANK LAST ORDER BY curr),',') AS employees
    FROM   (SELECT deptno,
                   ename,
                   ROW_NUMBER() OVER (PARTITION BY deptno ORDER BY ename) AS curr,
                   ROW_NUMBER() OVER (PARTITION BY deptno ORDER BY ename) -1 AS prev
            FROM   emp)
    GROUP BY deptno
    CONNECT BY prev = PRIOR curr AND deptno = PRIOR deptno
    START WITH curr = 1;
        DEPTNO EMPLOYEES
            10 CLARK,KING,MILLER
            20 ADAMS,FORD,JONES,SCOTT,SMITH
            30 ALLEN,BLAKE,JAMES,MARTIN,TURNER,WARD
    3 rows selected.at http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php

  • How can I load an external SWF into a movie clip that's inside other movie clip?

    Hi.
    I creating my first flash (actionscript 3.0) website but I'm
    stuck with a visual effect I want to create.
    I have a window on my website called contentWindow. Every
    time you click a button this window is supposed to leave the stage,
    load the requested content and return to the stage.
    The sliding window is a movie clip with 83 frames, 21 to
    enter the stage, 21 to leave the stage again, 20 for nothing (its
    just to simulate the loading time) and 21 to return to the stage.
    Now my goal is, when the user clicks on a navigation button,
    the window exits the stage, loads an external SWF with the content,
    and then returns to the stage.
    I've the "window" movie clip with an instance name of
    "contentWindow". Inside there is another movie clip with an
    instance name of "contentLoader". The content that the user
    requested should appear inside the "contentLoader".
    Now, when the contentWindow leaves the stage, I get this
    error message:
    quote:
    TypeError: Error #1009: Cannot access a property or method of
    a null object reference.
    at rwd_fla::MainTimeline/trigger()
    If I switch
    "contentWindow.contentLoader.addChild(navLoader);" for
    "contentWindow.addChild(navLoader);" it works fine, but the
    external SWF doesn't move with the window.
    How can I load an external SWF into a movie clip that's
    inside other movie clip?

    Hi,
    Recently, I have been putting together a flash presentation.
    And I am just wondering if the following might help you, in your
    communication with the said swf file:
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
    onComplete);
    function onComplete(event:Event):void
    event.target.content.thinggy_mc.y -= 100;
    Not the best example, but this allows you to target a mc
    within an external swf file. I think if you look up this code, you
    will have an answer ;)
    Kind Regards,
    Boxing Boom

  • Preview; How can I open multiple PDF's in one window with Preview?

    How can I open multiple PDF's in one window with Preview?
    I have gone to Previews preferences and selected 'Open groups of images in the same window' and have tried every setting imaginable and nothing works. What am I doing wrong?

    Hi, a few ways..
    http://www.monkeybreadsoftware.info/Freeware/CombinePDFs.shtml
    http://www.monkeybreadsoftware.info/Freeware/CombinePDFs.shtml
    http://www.macosxhints.com/article.php?story=20060327192826493&lsrc=osxh

  • How can I have multiple accounts and only one library

    How can I have multiple accounts and only one library that all the purchased items feed into?

    ask your wireless provider.

  • How Can I Set a Javascript Value into an Attribute of BSP PAGE

    Hi
    Can anyone tell me.
    How Can I Set a Javascript Value into an Attribute of BSP PAGE

    Hi Mithlesh,
    javascript runs on client side and you cannot assign the value to a Page attribute directly.
    As a workaround,you can use an Inputfield,hidden if required,and set the value using javascript.Then the form will have to be submit to be able to read the value in onInputProcessing and then can be assigned to any variable.
    In Layout
    <head>
    <script language="javascript">
    function pass()
       txt1 = document.getElementById("ip_mrf");
       txt.value = "hello" ;
    </script>
    </head>
    <htmlb:inputField  id="ip_mrf"
                               value="<%=mrf_number%>"
                               visible="FALSE"/>
    in onInputProcessing
    cha1 = request->get_form_field( 'ip_mrf' ).
    where cha1 is the page attribute
    hope this helps,
    Regards,
    Siddhartha
    Message was edited by: Siddhartha Jain

  • How can I add new row/column into existing jTable?

    Hi add!
    Can you help me how can I add new row/column into existing jTable?
    Tnx in adv!

    e.g
    Create two buttons inside the Table ( "Add New Row" ) and ("Add new Column")
    their handlers are:
    add new row:
    //i supose u already have
    DefaultTabelModel tablemodel = new DefaultTableModel(rowdata, columnNames);
    //and   
       JTabel jtable = new JTable(tablemodel);
    // Handler (row)
    jbtAddRow.addActionListener(new ActionListener(){
       public void actionPerformed(ActionEvent e) {
          if(jtable.getSelectedRow() >= 0 )
              tablemodel.insertRow(jtable.getSelectedRow(), new java.util.Vector());  
           else  
                tablemodel.addRow(new java.util.Vector());
        });to add new columns its the same but inside actionPerformed method:
    ask for e.g "Whats the name for the new column"
    then,
       tablemodel.addColumn(nameOfColumn, new java.util.Vector());   Joao
    Message was edited by:
    Java__Estudante

Maybe you are looking for

  • Send audit information to  mail acount using fined-grained auditing

    hi. i like to send audit information to particular mail account. but i have failed. is any one can help me. i have writtten step by step what i have done for my work. my mail server work properly. SQL> CONNECT SYS/PAS AS SYSDBA after that i have crea

  • Creating Dynamic Internal table with a dynamic name

    Hi, I want to create dynamic internal tables with dynamic names. For example: Suppose I have a table with three fields. 1. Structure name 2.Fields 3.file And the structure of the internal table is as follows: TYPES:BEGIN OF table_type,       struct  

  • Activate Rebates for Old Sales orders created

    Hi SAP Gurus, How to activate rebate agreement or rebate condition records to old sales orders which has been created at past ? let me take an example and explain: 1. Total sales cycle is created (Sales Order, Delivery & Billing with Accounting docum

  • Expressway-E/C Cluster max proxied registration

    Dear all I have seen in the Datasheet if we have Expressway Cluster with 6 , the capacity will increase to maximum of 10'000 proxied registration Is that correct If build a cluster with 2 the capacity will be increase to 5000 ? or less ?  Clustered C

  • Skype crashes when I start a call or join a call

    Whenever I try to call a friend of mine, my skype freezes and says "not responding" and then I have to close the program. Whenever I join a call, it enters not responding and either: A. I'm still in the call and I can hear my friends, but I am unable