|
|
|
|
|
15.2 e03 |
|
06 Jan 2011 |
Fixed |
|
|
|
|
|
If an expression containing an IN list was used in the
SELECT list of a query and also the GROUP BY clause of the
query, then it was possible for the query to fail with an
error such as: INVALID_GROUP_SELECT 53003
-149L "Function or column reference to '%1' must also
appear in a GROUP BY." ----
In order for this problem to occur, the IN list must have
contained 20 or more elements, and the element type of the
IN list must have been string literals, hex strings, or exact
NUMERIC literal with a decimal point. ----
For example, this statement could generate this problem:
select count(*), IF T.x IN ( '0', '1', '2', '3', '4', '5',
'6', '7', '8', '9', '10', '11', '12', '13', '14', '15',
'16', '17', '18', '19', '20', '21', '22', '23', '24', '25',
'26', '27', '28', '29' ) THEN 1 ENDIF from T group by IF T.x
IN ( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10',
'11', '12', '13', '14', '15', '16', '17', '18', '19', '20',
'21', '22', '23', '24', '25', '26', '27', '28', '29' )
THEN 1 ENDIF ----
This problem is fixed, but the expressions containing the
IN lists must contain the elements in exactly the same
order or the error is returned. For a server without
the fix, a recommended workaround is to rewrite the query to
compute the expression in a derived table. ----
For example: ----
select count(*), D.yyy from ( select T.*, IF T.x IN ( '0',
'1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11',
'12', '13', '14', '15', '16', '17', '18', '19', '20', '21',
'22', '23', '24', '25', '26', '27', '28', '29' ) THEN 1
ENDIF as yyy from T ) as D group by D.yyy |
|
Workaround Description |
|
1) Modified QUERY: -> delete T alias in group by clause
Question-> even if customer use alias, why does problem query occur error?
select...
into..
from (select..
from..
where...) as T
group by T.gigwan_code,T.customer_no,T.customer_gubun,T.budo_occur_date,T.budo_type_code,T.bujum_code,T.cancel_yn;
==> If i changed group by clause like below, the query run well.
(That is,delete T alias in group by clause).
select...
into..
from (select..
from..
where...) as T
group by gigwan_code,customer_no,customer_gubun,budo_occur_date,budo_type_code,bujum_code,cancel_yn;
2) Modified QUERY: -> decreased in value in the case..when clause.
Question-> Why does below query ok ?
select...
into..
from (select......
......
(case when bullang_cause_code in( '0101','0102','0103' ) then '51'
when bullang_cause_code in( '0901','0902','0903','0904' ) then '53'
when bullang_cause_code in( '0401','0402','0403','0404','0501','0502','0503' ) then '54'
when bullang_cause_code in( '1003','1004','1006','1101','1201','1301','1403','1701','1901' ) then '55'
when bullang_cause_code in( '0601','0602','0603' ) then '56'
when bullang_cause_code in( '0604','0605','0606' ) then '57'
when bullang_cause_code in( '0611','0612','0613' ) then '58'
when bullang_cause_code in( '0701','0702','0703' ) then '59'
when bullang_cause_code in( '0801' ) then '60'
when bullang_cause_code in( '0802','0803','0804' ) then '61' end) as budo_type_code,
from..
where...) as T
group by .... |
|
|
|