y***@unisystems.gr
2006-01-20 09:09:13 UTC
Hello to all
I am new to DB2 and encountered a "problem" on the way
DB2 UDB 8.2 (UTF8 code page) treates aliases.
We try to make a join between to tables and use an allias to define the name of a column at the result set.
When the alias is written in UPPERCASE it works fine. If the alias is lowercase it does not.
This simple SQL commands can show the problem
CREATE TABLE DB2ADMIN.TABLE1 ( common CHARACTER (10) NOT NULL , t1col2 CHARACTER (10) NOT NULL ) ;
CREATE TABLE DB2ADMIN.TABLE2 ( common CHARACTER (10) NOT NULL , t2col2 CHARACTER (10) NOT NULL ) ;
SELECT table1.common, table1.t1col2 from table1
union select table2.common, table2.t2col2 "t1col2" from table2
This results to the second column to be names as "2" instead of "t1col2"
If we give the select union statement as
select table1.common, table1.t1col2 from table1
union select table2.common, table2.t2col2 "T1COL2" from table2
it works fine.
Is there a way, a setting or something to change this behavior ?????
(In ORACLE this works no matter lower or uppercase)
I am new to DB2 and encountered a "problem" on the way
DB2 UDB 8.2 (UTF8 code page) treates aliases.
We try to make a join between to tables and use an allias to define the name of a column at the result set.
When the alias is written in UPPERCASE it works fine. If the alias is lowercase it does not.
This simple SQL commands can show the problem
CREATE TABLE DB2ADMIN.TABLE1 ( common CHARACTER (10) NOT NULL , t1col2 CHARACTER (10) NOT NULL ) ;
CREATE TABLE DB2ADMIN.TABLE2 ( common CHARACTER (10) NOT NULL , t2col2 CHARACTER (10) NOT NULL ) ;
SELECT table1.common, table1.t1col2 from table1
union select table2.common, table2.t2col2 "t1col2" from table2
This results to the second column to be names as "2" instead of "t1col2"
If we give the select union statement as
select table1.common, table1.t1col2 from table1
union select table2.common, table2.t2col2 "T1COL2" from table2
it works fine.
Is there a way, a setting or something to change this behavior ?????
(In ORACLE this works no matter lower or uppercase)