I have an issue where some scripts I run have the following conditions:
Cast (no As char(6)) = '008812' OR Cast (no As char(6)) = '008816' OR Cast (no As char(5)) = '00882' OR Cast (no As char(6)) = '008818' OR Cast (no As char(5)) = '00881'
Looking to match number ranges, which could be 2 or more characters long - as I need to tell teradata the string length each time, I use an access database to count the string length and create a script (as often I need to find hundereds of number ranges).
Is there a way to achieve this a more elegant way just using teradata? I'd have thought that perhaps a table containing the range, and the range length as two columns, and then some kind of Cast statement with two embedded select statements would work, but i've had problems in implementing this.
My questions are:
1. Is there a way of achieving this?
2. If so, is it usually more efficient to dip into a table, or have the cast statements within a script ? (I would compare via the explain tool, but without being able to implement it, it's impossible to compare!).