View previous topic :: View next topic |
Author |
Message |
pkrish_18 Beginner
Joined: 08 Apr 2005 Posts: 12 Topics: 7
|
Posted: Wed Feb 21, 2007 4:10 pm Post subject: Compare Char column and Interger in wher clause of Join |
|
|
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 |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Wed Feb 21, 2007 4:38 pm Post subject: |
|
|
why not INTEGER the ...item_ran col? _________________ Dick Brenholtz
American living in Varel, Germany |
|
Back to top |
|
|
pkrish_18 Beginner
Joined: 08 Apr 2005 Posts: 12 Topics: 7
|
Posted: Thu Feb 22, 2007 11:40 am Post subject: |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Thu Feb 22, 2007 11:49 am Post subject: |
|
|
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 |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Thu Feb 22, 2007 12:04 pm Post subject: |
|
|
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 |
|
|
|
|