USING SUBSTR and DIGIT or CAST in Where clause



IBM's flagship relational database management system

USING SUBSTR and DIGIT or CAST in Where clause

Postby sinmani » Thu Apr 03, 2014 3:05 pm

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.
-----------------------------------------
As long as you think you are a student, you are doing well.
The day you consider yourself as the master of the game..........well
sinmani
 
Posts: 93
Joined: Thu Mar 22, 2012 10:02 am
Has thanked: 14 times
Been thanked: 0 time

Re: USING SUBSTR and DIGIT or CAST in Where clause

Postby dick scherrer » Sun Apr 06, 2014 8:01 am

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post