Get Data from the Database based on a key column.
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 467
- Joined: Tue Mar 20, 2007 6:36 am
- Location: Chennai
- Contact:
Get Data from the Database based on a key column.
Hi all,
We have a scenario in which we need to pass data into a DB table and get the output based on the input column.
I have a job which has
SequentialFile--------->DRS_Stage-------------->SequentialFile
I am giving this query in the inputs tab of the DRS_Stage.
And it throws up a warning " Variables are not bound correctly".
This is not the exact query. But it looks like this.
select * from emp where emID=:1
Can we use the data coming from the input link of the DRS stage as a bind variable in the Inputs tab.
We have a scenario in which we need to pass data into a DB table and get the output based on the input column.
I have a job which has
SequentialFile--------->DRS_Stage-------------->SequentialFile
I am giving this query in the inputs tab of the DRS_Stage.
And it throws up a warning " Variables are not bound correctly".
This is not the exact query. But it looks like this.
select * from emp where emID=:1
Can we use the data coming from the input link of the DRS stage as a bind variable in the Inputs tab.
Minhajuddin
<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>
<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>
-
- Participant
- Posts: 467
- Joined: Tue Mar 20, 2007 6:36 am
- Location: Chennai
- Contact:
But here the query has a "START WITH" clause and we put the :1 in the Start with clause
Initially we had a transformer which did the lookup into this table and returned rows. But now the number of rows returned for one input record is equal to four. And the transformer just gets a single match record.
Thanks for the help DSguru
Code: Select all
select customer
from (select customer, parent_customer, customer_level
from (select customer_number as customer,
parenthdqtrcustomernum as parent_customer,
level as customer_level
from customer
start with customer_number = :1
connect by prior parenthdqtrcustomernum =
customer_number) d1
order by customer_level desc) d2,
(select nvl(max(customer_level), 0) as max_customer_level
from (select customer_number as customer,
parenthdqtrcustomernum as parent_customer,
level as customer_level
from customer
start with customer_number = :1
connect by prior parenthdqtrcustomernum =
customer_number)) d3
where rownum <= 4
Initially we had a transformer which did the lookup into this table and returned rows. But now the number of rows returned for one input record is equal to four. And the transformer just gets a single match record.
Thanks for the help DSguru
Minhajuddin
<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>
<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>
-
- Participant
- Posts: 467
- Joined: Tue Mar 20, 2007 6:36 am
- Location: Chennai
- Contact:
My backend DB is Oracle.
So if I use a lookup. Will it not throw warnings if we have more than one match in the lookup table?
Thanks again.
So if I use a lookup. Will it not throw warnings if we have more than one match in the lookup table?
Thanks again.
Minhajuddin
<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>
<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>
-
- Participant
- Posts: 467
- Joined: Tue Mar 20, 2007 6:36 am
- Location: Chennai
- Contact:
Thanks DSguru.
But my DB is huge. So, I can't use the Lookup stage unless I make it a Sparse Lookup. I have done that. Since my input file also has a large amount of data, I was just wondering if we had any other way to implement this.
Thank you.
But my DB is huge. So, I can't use the Lookup stage unless I make it a Sparse Lookup. I have done that. Since my input file also has a large amount of data, I was just wondering if we had any other way to implement this.
Thank you.
Minhajuddin
<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>
<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
But you asserted that this is a server job. If it is, then an ODBC stage with multi-row return is an ideal solution, particularly if the search key is indexed in the Oracle table.Minhajuddin wrote:But my DB is huge. So, I can't use the Lookup stage unless I make it a Sparse Lookup. I have done that. Since my input file also has a large amount of data, I was just wondering if we had any other way to implement this.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 467
- Joined: Tue Mar 20, 2007 6:36 am
- Location: Chennai
- Contact:
Thanks for all your responses guys! :D
I am using a sparse lookup on the table, the performance will degrade because of this. But this the only choice I have.
Once again thank you.
I am using a sparse lookup on the table, the performance will degrade because of this. But this the only choice I have.
Once again thank you.
Minhajuddin
<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>
<a href="http://feeds.feedburner.com/~r/MyExperi ... ~6/2"><img src="http://feeds.feedburner.com/MyExperienc ... lrow.3.gif" alt="My experiences with this DLROW" border="0"></a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: