Page 1 of 1

Union Function

Posted: Tue Aug 03, 2010 10:55 am
by kpsita
Hi,

I have a requirement where I need to add couple of values to the values I selected from a tables. How do I implement this in datastage.

For example, I do a select field1 from TableA on a DB2 stage. And now I need to add two more values to this selected field1 like AAA and BBB. When I do

select field1 from TableA
union all
values ('AAA')
union all
values('BBB')

The DB2 stage takes for ever to return the value. Is there any other alternate method. Thanks in advance.

Posted: Tue Aug 03, 2010 11:08 am
by anbu
You can create two rows using Row Generator by setting Number of Records as 2 and define the default values as "AAA" and "BBB".

Use funnel to combine DB2 data and Row Generator data.

Posted: Tue Aug 03, 2010 12:54 pm
by allavivek
anbu wrote:You can create two rows using Row Generator by setting Number of Records as 2 and define the default values as "AAA" and "BBB".

Use funnel to combine DB2 data and Row Generator data.
I think for using funnel operation the metadata of input links should be same....

correct me if iam wrong...

Posted: Tue Aug 03, 2010 1:11 pm
by anbu
Yes metadata should be same in all input links to the Funnel stage.

Posted: Tue Aug 03, 2010 1:14 pm
by kris007
The OP's post and example indicates that the output is required only one column and not multiple columns. So, anbu's solution will work.

Posted: Tue Aug 03, 2010 1:14 pm
by arun_im4u
Yes.

From Anbu's design..

--Define the column name(field 1) in the row generator as the same as what is defined in DB2.
-- Open the properties for that column in the row generator stage. Click on Algorithm. Add values ('AAA'). Add the values again ('BBB').
-- Set the row generator to run only for 2 rows and join with the DB2 output using the funnel stage.

Posted: Tue Aug 03, 2010 1:15 pm
by allavivek
kris007 wrote:The OP's post and example indicates that the output is required only one column and not multiple columns. So, anbu's solution will work.
Yes ...i over looked it...

Posted: Tue Aug 03, 2010 1:41 pm
by kpsita
This works perfect.

Thank you all for your help.