Page 1 of 1

Modify Stage Column Name Change

Posted: Tue Apr 03, 2007 9:24 am
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.

Posted: Tue Apr 03, 2007 9:29 am
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.

Posted: Tue Apr 03, 2007 9:45 am
by lfong
The error is occuring on the read(oraread). I an using the Oracle enterprise stage for the source.

Posted: Tue Apr 03, 2007 10:42 pm
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.

Posted: Wed Apr 04, 2007 4:44 pm
by Madhusv
Datastage does not supports '-' in the field names

Posted: Thu Apr 12, 2007 10:07 am
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.

Posted: Thu Apr 12, 2007 3:17 pm
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.

Posted: Thu Apr 12, 2007 4:19 pm
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.

Posted: Mon Apr 16, 2007 7:27 am
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.

Posted: Mon Apr 16, 2007 8:46 am
by us1aslam1us
After importing the table definition change the column name to different one or the alias name on the columns tab.