Archives of the TeradataForum
Message Posted: Mon, 25 Apr 2005 @ 20:55:06 GMT
somebody made me aware of a new (would be interesting when it was implemented) syntax on in-clauses - which can drive you crazy in case of typos.
My first expectation was that
select (current_date - calendar_date) (format '99') (char(2)) as char_field from sys_calendar.calendar where char_field in ('01' '02','03') and (current_date - calendar_date) > 0 ;
would cause an error - for the missing ',' between '01' and '02'.
But GCC told the customer it is correct because it is ANSI compliant for an concatenation - at least one black between the '01' and '02' - no blanck would be evaluated as "01'02".
Which means the in-Clause is evaluated as ('0102','03) and in this respect the result is correct.
Is this type of concatenation limited to IN-Clauses?
Select '01' '02'
is resulting in '01' with the column name of '02'?
Andselect (current_date - calendar_date) (format '99') (char(2)) 'XX' from sys_calendar.calendar where ((current_date - calendar_date) (format '99') (char(2))) in ('01' '02','03') and (current_date - calendar_date) > 0 ;
in an error.
Can somebody bring some light into this? It's a bit strange from my pointo of view...
|Copyright 2016 - All Rights Reserved|
|Last Modified: 27 Dec 2016|