Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

A question concerning LIKE - response (1) by dnoeth

$
0
0

Hi Gwenael,
are there trailing blanks in PK1 or PK2, are they defined as CHAR or VARCHAR?
The LIKE might also return wrong rows, when PK1 is not fixed length, e.g. 'abcd-1' LIKE 'abc' || '%'.
To extract the first part up to the suffix you might use SUBSTRING:

substring(p1 from 1 for position('-' in P1)-1)

If the '-' might be missing you have to put it into a CASE.
In TD14 there are built-in functions to split strings, e.g. STRTOK, but all those solutions will not fix the root cause of your problem: bad database design.
The suffix should be in a seperate column, so both tables can share the same PI, otherwise you'll never get fast joins.
 
Dieter
 

 


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>