<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: [resolved] Inserting one-to-many relationship rows into Oracle database in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/resolved-Inserting-one-to-many-relationship-rows-into-Oracle/m-p/2208107#M7474</link>
    <description>My way to do such kind of things is always staging the input data in a table and than separating dimensions and facts (or other dimensions). All possible ways within Talend needs inserts or updates in table1 and commit size == 1 which is extrem slow. If it is not desired to use a staging table and you can read the input source twice without problems then use tAggregateRow to fill table1 and after that read input again and fill table2 via a tMap and a lookup to table1.</description>
    <pubDate>Mon, 06 Jan 2014 22:52:56 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2014-01-06T22:52:56Z</dc:date>
    <item>
      <title>[resolved] Inserting one-to-many relationship rows into Oracle database</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Inserting-one-to-many-relationship-rows-into-Oracle/m-p/2208106#M7473</link>
      <description>Hi, 
&lt;BR /&gt;I have a situation as follows. My data flow is of the format: 
&lt;BR /&gt;c_id | key | value 
&lt;BR /&gt;--------------- 
&lt;BR /&gt;123 | 5 | Harry 
&lt;BR /&gt;123 | 7 | Jones 
&lt;BR /&gt;234 | 5 | John 
&lt;BR /&gt;234 | 6 | S 
&lt;BR /&gt;234 | 7 | Smith 
&lt;BR /&gt;Note that the number of key/value pairs for each c_id is variable and can be anywhere from 1-20 or so 
&lt;BR /&gt;Now, I need to insert this data into an Oracle database consisting of two tables. Table 1 contains the c_id and uses a sequence as its primary key. Table 2 contains the key and value combination with a foreign key reference to Table 1's primary key(the sequence) and it's own sequence as it's primary key. Table 1 and Table 2 have more data associated with them, but it is irrelevant to the question and I am able to invoke the sequences within Talend already. 
&lt;BR /&gt;So, in the above example, I need the Tables to look like this: 
&lt;BR /&gt;Table 1: 
&lt;BR /&gt;PK | c_id 
&lt;BR /&gt;---------- 
&lt;BR /&gt;100 | 123 
&lt;BR /&gt;101 | 234 
&lt;BR /&gt; 
&lt;BR /&gt;Table 2: 
&lt;BR /&gt;PK | FK | key | value 
&lt;BR /&gt;------------------------- 
&lt;BR /&gt;1 | 100 | 5 | Harry 
&lt;BR /&gt;2 | 100 | 7 | Jones 
&lt;BR /&gt;3 | 101 | 5 | John 
&lt;BR /&gt;4 | 101 | 6 | S 
&lt;BR /&gt;5 | 101 | 7 | Smith 
&lt;BR /&gt; 
&lt;BR /&gt;The problem I'm having is with looping in such a way that for each unique c_id, insert the data into Table 1, then for each row with that c_id, add the data to Table 2, and then returning the sequence value being generated (Table 1 PK) for each of the entries into Table 2. The rows will always be sorted based on c_id. 
&lt;BR /&gt;The only way I can see doing this is by getting a unique list of c_id's and creating the entries into Table 1 first. Then, upon completion of that, go back and insert the values into Table 2, selecting the PK from Table1 where the c_id's match, but that seems like an unnecessary inner select. 
&lt;BR /&gt;So, is there a way within Talend that I can group these raw rows by the c_id, then insert one row into Table 1 for each group and then insert a row into Table 2 for each key/value pair within that group? 
&lt;BR /&gt;Thank you</description>
      <pubDate>Sat, 16 Nov 2024 11:47:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Inserting-one-to-many-relationship-rows-into-Oracle/m-p/2208106#M7473</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T11:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Inserting one-to-many relationship rows into Oracle database</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Inserting-one-to-many-relationship-rows-into-Oracle/m-p/2208107#M7474</link>
      <description>My way to do such kind of things is always staging the input data in a table and than separating dimensions and facts (or other dimensions). All possible ways within Talend needs inserts or updates in table1 and commit size == 1 which is extrem slow. If it is not desired to use a staging table and you can read the input source twice without problems then use tAggregateRow to fill table1 and after that read input again and fill table2 via a tMap and a lookup to table1.</description>
      <pubDate>Mon, 06 Jan 2014 22:52:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Inserting-one-to-many-relationship-rows-into-Oracle/m-p/2208107#M7474</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-01-06T22:52:56Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Inserting one-to-many relationship rows into Oracle database</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Inserting-one-to-many-relationship-rows-into-Oracle/m-p/2208108#M7475</link>
      <description>Thank you.&lt;BR /&gt;I decided to go with your second solution as it was much simpler than using a staging table and from my tests is still very fast without needing an inner select.</description>
      <pubDate>Tue, 07 Jan 2014 16:03:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Inserting-one-to-many-relationship-rows-into-Oracle/m-p/2208108#M7475</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-01-07T16:03:37Z</dc:date>
    </item>
  </channel>
</rss>

