How to update a table there is a expression in the sql

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
dongyingying
Participant
Posts: 35
Joined: Tue Feb 07, 2012 2:28 am
Location: China BeiJing

How to update a table there is a expression in the sql

Post by dongyingying »

when I want to update a column and set the column_a = column_a * percent in a table in a stage, also in the input link there are two columns and named to key_1 and percent.

so the sql i want to write to like :

update table_name set column_a = column_a * percent where key_1=? ;

but when i run the job there is a error :
Task_one_point_two..Employee: [IBM][CLI Driver][DB2/AIX64] SQL0206N "percent" is not valid in the context where it is used. SQLSTATE=42703

who can help me out thanks.
Dong Ying Ying Come on.
HendrikB
Premium Member
Premium Member
Posts: 15
Joined: Tue Feb 07, 2012 6:01 am

Re: How to update a table there is a expression in the sql

Post by HendrikB »

Which DB stage do you use for custom sql?

In case of using the DB2 Connector for example try this ...

update table_name set column_a = column_a * orchestrate.percent where key_1=orchestrate.key_1 ;

'orchestrate' means taking the column value out of the ETL flow at runtime
dongyingying
Participant
Posts: 35
Joined: Tue Feb 07, 2012 2:28 am
Location: China BeiJing

Post by dongyingying »

HendrikB,

yes, u r right ,when i check it ,I found the sql can't be write to Column_a =Column_a*(1+percent), The bracket can not be accept in the sql.
Dong Ying Ying Come on.
Post Reply