TheMartian
MIS
When running an INSERT/SELECT with a number of CASE statements in the SELECT clause an error '6706 Untranslatable Character' occurs. This happens in both Queryman and a Mainframe BTEQ script. All the data being processed is within existing Teradata tables i.e. no load files are being used.
Changing the CASE statements to COALESCE works fine in both instances. The FROM clause in the query includes a derived table which uses CASE statements as well
The SQL which fails is:
INSERT Mynewtable
(
column_1,
column_2,
column_3
column_4
.........
)
SELECT column_a
,column_b
,column_c
,(CASE
WHEN column_d IS NULL THEN 'N'
ELSE column_d END)
.......
Whilst the following does not return an error:
INSERT Mynewtable
(
column_1,
column_2,
column_3,
column_4
.........
)
SELECT column_a
,column_b
,column_c
,COALESCE(Column_d, 'N')
.......
Also whilst investigating this error it was noticed that a mainframe BTEQ EXPORT using only the SELECT portion of the code put two 'rogue' bytes in the output file before the field which used the first CASE statement i.e. between column_c and column_d. These do not appear when either the CASE statement is completely removed or replaced by COALESCE.
Anyone know why the CASE statement fails?
I have used this construct in the past with no problems. Obviously I have a workaround which works, but out of curiousity I'd like to know what the problem is with using CASE in this instance.
Thanks
Martin
Changing the CASE statements to COALESCE works fine in both instances. The FROM clause in the query includes a derived table which uses CASE statements as well
The SQL which fails is:
INSERT Mynewtable
(
column_1,
column_2,
column_3
column_4
.........
)
SELECT column_a
,column_b
,column_c
,(CASE
WHEN column_d IS NULL THEN 'N'
ELSE column_d END)
.......
Whilst the following does not return an error:
INSERT Mynewtable
(
column_1,
column_2,
column_3,
column_4
.........
)
SELECT column_a
,column_b
,column_c
,COALESCE(Column_d, 'N')
.......
Also whilst investigating this error it was noticed that a mainframe BTEQ EXPORT using only the SELECT portion of the code put two 'rogue' bytes in the output file before the field which used the first CASE statement i.e. between column_c and column_d. These do not appear when either the CASE statement is completely removed or replaced by COALESCE.
Anyone know why the CASE statement fails?
I have used this construct in the past with no problems. Obviously I have a workaround which works, but out of curiousity I'd like to know what the problem is with using CASE in this instance.
Thanks
Martin