View previous topic :: View next topic
|
Author |
Message |
kishpra
New User
Joined: 24 May 2010 Posts: 92 Location: Pune
|
|
|
|
While binding a DB2 program, I am getting the below error as -
Statement 2140 – SQLcode -338 - AN ON CLAUSE IS INVALID
Statement 3572 – SQLcode -206 - TOKENS=A.CARD_NM_SUR - IS NOT VALID IN THE CONTEXT WHERE IT IS USED
Code: |
EXEC SQL
DECLARE LNBR
CURSOR FOR
SELECT
K.CASENO
, K.CASETYP
, K.MCH_RS_MCHNO
, K.MCH_RS_MCH_TYP
, K.QS_CAT_QSTYP
, A.CARD_NBR
, A.CARD_NM_SUR
FROM
CASE K
LEFT OUTER jOIN ACI A
ON M_MCHNO = :SQL-MCH-NUM
AND M_RS_MCH_TYP = :SQL-MCH-TYP
AND CASENO = CASE_DFN_CASENO
AND CASETYP = CASE_DFN_CASETYP
AND QS_CAT_QRTYP = 'DFR'
AND CASENO > :SQL-CASENO |
Also CARD_NM_SUR is a column of table A.
Please suggest. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Quote: |
-338 AN ON CLAUSE IS INVALID
Explanation:
This return code reports a violation of one of the
following:
v One expression of the predicate must only reference
columns of one of the operand tables of the
associated join operator, full join, and the other
expression of the predicate must only reference
columns of the other operand table. |
Quote: |
-206 => -206 name IS NOT VALID IN THE
CONTEXT WHERE IT IS USED |
Check if A.CARD_NM_SUR name is correct |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Please learn to use BBcode Tags - I've added them to align your code. Have you looked at the explanation of -338?
Quote: |
-338 AN ON CLAUSE IS INVALID
Explanation: This return code reports a violation of one of the following:
o One expression of the predicate must only reference columns of one of the operand tables of the associated join operator, full join, and the other expression of the predicate must only reference columns of the other operand table.
o A VALUE or COALESCE function is allowed in the ON clause only when the join operator is a FULL OUTER JOIN or FULL JOIN.
o An operator other than '=' is not allowed in a FULL OUTER JOIN or FULL JOIN.
o A subquery is not allowed in the ON clause. |
Can you use host-variable :SQL-MCH-NUM for "ON" in this case?
Is CASE a table name?
What tables do the ON columns qualifies to?
And why do you post your thread under the subject "DB2 BIND ERRO(r)"? |
|
Back to top |
|
|
|