Page 1 of 1

USING SUBSTR and DIGIT or CAST in Where clause

PostPosted: Thu Apr 03, 2014 3:05 pm
by sinmani
SO_NO from one OH table is Decimal(8,0)
EOD4_TX value from D4 table is CHAR 250. with SO NO embedded in it from position 1 to 8.

I have to select various fields from both these tables and in the where clause I have to equate
the SO_NO.

How can this be achieved.

SELECT AA , BB,CC FROM DB2XXXI.OKTATD4 D4
,DB2XXXI.OKORTOH OH
WHERE DIGITS(OH.SO_NO) =
DIGITS(SUBSTR(SELECT EOD4_TX FROM DB2OMMI.OKTATD4),1,8)
WITH UR;



But This doec not work ?? I even tried CAST but it didn't work out too

Please help.

Re: USING SUBSTR and DIGIT or CAST in Where clause

PostPosted: Sun Apr 06, 2014 8:01 am
by dick scherrer
Hello,

Suggest you post some sample values and what should happen when these values are processed.

Also post what does happen that is not what you want.