MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Compare Char column and Interger in wher clause of Join

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
pkrish_18
Beginner


Joined: 08 Apr 2005
Posts: 12
Topics: 7

PostPosted: Wed Feb 21, 2007 4:10 pm    Post subject: Compare Char column and Interger in wher clause of Join Reply with quote

Hi ,

Am running the following query,

SELECT *
FROM Qualifier.T1 SD,
Qualifier.T2 PA
WHERE PA.PICK_CAND_ORD_HDR = SD.FK_SALES_ORDER_NUM
AND INTEGER(PA.PICK_CAND_ORD_LINE) =
SD.FK_SALES_ITEM_RAN
WITH UR;

It errors out with SQLCODE = -686.

Note that Column definitions for PA.PICK_CAND_ORD_LINE and SD.FK_SALES_ITEM_RAN are CHAR's.

My objective is to use the integer value of PA.PICK_CAND_ORD_LINE to compare with SD.FK_SALES_ITEM_RAN(which is a char column).

Can anyone provide me a solution.

Thanks,

PK
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Wed Feb 21, 2007 4:38 pm    Post subject: Reply with quote

why not INTEGER the ...item_ran col?
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
pkrish_18
Beginner


Joined: 08 Apr 2005
Posts: 12
Topics: 7

PostPosted: Thu Feb 22, 2007 11:40 am    Post subject: Reply with quote

Am really sorry. Column defn for SD.FK_SALES_ITEM_RAN is INTEGER. And when we try to compare PA.PICK_CAND_ORD_LINE(which is defined as CHAR), it throughs an error. So the only choice is to compare by converting the Datatype of PA.PICK_CAND_ORD_LINE to INTEGER.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Thu Feb 22, 2007 11:49 am    Post subject: Reply with quote

pkrish_18 wrote:
Am really sorry. Column defn for SD.FK_SALES_ITEM_RAN is INTEGER. And when we try to compare PA.PICK_CAND_ORD_LINE(which is defined as CHAR), it throughs an error. So the only choice is to compare by converting the Datatype of PA.PICK_CAND_ORD_LINE to INTEGER.


pkrish_18,

try this

Code:

WHERE PA.PICK_CAND_ORD_HDR = CHAR(SD.FK_SALES_ORDER_NUM)


hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Thu Feb 22, 2007 12:04 pm    Post subject: Reply with quote

are you sure that your incompatibility is not in the other half of the where clause? or possibly, are there dec and not int?
suggest you run the query twice, each time only using half of the where clause.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group