oracle table name as parameter

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
ppalka
Participant
Posts: 118
Joined: Thu Feb 10, 2005 7:25 am
Contact:

oracle table name as parameter

Post by ppalka »

Is there any way to pass an oracle table name as parameter from input data? I have a column table_name in my input data and I want to use it to update that table.
I have such table:

FOR r_ct_map IN (SELECT fermat_contract_type, view_name, table_name
FROM e_contract_type_map) LOOP

And for every record in that table I need to do such operation:

l_inrownum := l_inrownum + 1;
l_table_name := r_ct_map.table_name;
l_view_name := r_ct_map.view_name;

l_stmt := 'UPDATE '
|| l_table_name
|| ' SET FERMAT_CONTRACT_TYPE=:1'
|| ' WHERE CONTRACT_ID IN (SELECT CONTRACT_ID AS ID FROM '
|| l_view_name
|| ')';

EXECUTE IMMEDIATE l_stmt
USING r_ct_map.fermat_contract_type;

Is it possible to implement this through DS?

Thanks in advance.

Piotrek
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In general, not within a single DataStage job.

You might build such a strategy into a job sequence; capture the results of the first query somewhere and use those results to supply job parameter values to a job that processes the table/view.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply