Modify Stage Column Name Change

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
lfong
Premium Member
Premium Member
Posts: 42
Joined: Fri Sep 09, 2005 7:48 am

Modify Stage Column Name Change

Post by lfong »

I am using the modify stage to change a column name that has '-' (Specification = CAUSE_EN = Cause-en). When I run the job, I get the following error:

main_program: Syntax error: Error in "oraread" operator: Error in output redirection: Error in output parameters: Error in modify adapter: Error in binding: Expected '=', got: "-", line 30 [osl\osl.C:135]

I know the modify stage can change the datatype of a column, but can it rename a column name. If this is not possible should I drop and and a new column using the old column name definition.
michaeld
Premium Member
Premium Member
Posts: 88
Joined: Tue Apr 04, 2006 8:42 am
Location: Toronto, Canada

Post by michaeld »

Don't need to use a modify stage to change the name of a column. Use the copy stage (or the next stage reading the input). Copy stage gets optimized out of the job when it is compiled so there is no extra overhead.


PS: you can use a modify stage to rename columns, but it functions and rules are different than for other stages.
Mike
lfong
Premium Member
Premium Member
Posts: 42
Joined: Fri Sep 09, 2005 7:48 am

Post by lfong »

The error is occuring on the read(oraread). I an using the Oracle enterprise stage for the source.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Modify stage certainly can change a column name. For example:

Code: Select all

Specification:  newcolumn=oldcolumn
As you note, the problem is reading from Oracle. Are you using direct read or SQL as the extraction method?
There may also be a problem in the Modify stage, but solve the Oracle issue first.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Madhusv
Participant
Posts: 35
Joined: Sat May 07, 2005 1:38 am
Contact:

Post by Madhusv »

Datastage does not supports '-' in the field names
lfong
Premium Member
Premium Member
Posts: 42
Joined: Fri Sep 09, 2005 7:48 am

Post by lfong »

The error message was pretty self-explanatory as to what the problem is. When I use the modify stage to rename the column, I am getting the same error on the oraread. Is there possibly another solution or should I create a view of the table and rename the column with the problem, or call IBM and create a case.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Just put the column name in double quotes in the SELECT statement. Otherwise the "-" character could be interpreted as a request to perform subtraction. And/or you can use an alias column name in the SELECT statement; there's no need to create a 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.
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

As mentioned you can use alias name or double quotes or square bracket in the select statement, if it has something to do with the raeding the column in the Oracle Enterprise stage.
I haven't failed, I've found 10,000 ways that don't work.
Thomas Alva Edison(1847-1931)
lfong
Premium Member
Premium Member
Posts: 42
Joined: Fri Sep 09, 2005 7:48 am

Post by lfong »

ray.wurlod wrote:Just put the column name in double quotes in the SELECT statement. Otherwise the "-" character could be interpreted as a request to perform subtraction. And/or you can use an alias column name in the SELECT statement; there's no need to create a view.
Do I have to do anything special with the column name that is imported as part of the table definition. I am still getting the same error. When I look at the OSH output, I still see the '-' in the column name, but I see \'\'column-name\'\' as part of the column name.
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

After importing the table definition change the column name to different one or the alias name on the columns tab.
I haven't failed, I've found 10,000 ways that don't work.
Thomas Alva Edison(1847-1931)
Post Reply