Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

Getting a unique value for VARCHAR field. - response (5) by suhailmemon84

$
0
0
Hi Dieter, You mentioned in your previous post that : "If you're not on TD13.10 simply cut & paste the source code and replace inBytes with PROC_DESCR" We're currently on 13.10 and we would like to use the function: BYTE(4) to unsigned integer (BIGINT) REPLACE FUNCTION Byte4_to_UnsignedInt (inBytes VARBYTE(4)) RETURNS BIGINT LANGUAGE SQL CONTAINS SQL DETERMINISTIC RETURNS NULL ON NULL INPUT SQL SECURITY DEFINER COLLATION INVOKER INLINE TYPE 1 RETURN HASHBUCKET(inBytes (BYTE(4))) / ((HASHBUCKET()+1)/65536) * 65536. + HASHBUCKET(SUBSTR(inBytes,3,2) (BYTE(4))) / ((HASHBUCKET()+1)/65536) ; Can we still use it? If not, can we know what changes we need to make to make it work on 13.10? Also, I did not entirely understand the logic: HASHBUCKET(inBytes (BYTE(4))) / ((HASHBUCKET()+1)/65536) * 65536. + HASHBUCKET(SUBSTR(inBytes,3,2) (BYTE(4))) / ((HASHBUCKET()+1)/65536) It would be great if you can explain me this logic. I could understand why you divided by ((HASHBUCKET()+1)/65536) (to handle hashbucket being 20 bit now), but I didn't understand why multiply by 65536 and no substr in first part(of addition) and apply substr and not multiply in the other part(of the addition) -Suhail  

Viewing all articles
Browse latest Browse all 27759

Trending Articles



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