Hello everyone,
I wrote this query, but I keep getting this error. Does anyone know what Im doing wrong?
Failed to retrieve data from database.
Details 42S22:[IBM][CLI Driver][DB2/6000} SQL0206N " DATAAUDIT.KEY_REPRESENTATION" is not valid in the context where it is used. SQLSTATE = 42703
DATAbase Vendor Code:-206]
My Query
SELECT
DATAAUDIT.KEY_REPRESENTATION
, CAST(SUBSTRING(DATAAUDIT.KEY_REPRESENTATION,charindex('=',DATAAUDIT.KEY_REPRESENTATION)+1,(charindex('|',DATAAUDIT.KEY_REPRESENTATION) - charindex('=',DATAAUDIT.KEY_REPRESENTATION)-1)) as BIGINT) as MEMBER_NBR
, CAST(SUBSTRING(DATAAUDIT.KEY_REPRESENTATION,charindex('=',DATAAUDIT.KEY_REPRESENTATION,charindex('=',DATAAUDIT.KEY_REPRESENTATION)+1)+1,LEN(DATAAUDIT.KEY_REPRESENTATION)) AS BIGINT) as LOAN_NBR
, DATAAUDIT.FOCUS_TELLER_ID
, LOAN. RATE
, LOAN. Loan_Type
, PRODUCT.PRODUCT_NAME
, LOAN.Rate_Delta as Manual_RATE
, DATAAUDIT.ACTIVITY_ID
, DATAAUDIT. TABLE_NAME
, DATAAUDIT. ADDTIMESTAMP
, DATAAUDIT.COLUMN_NAME
, DATAAUDIT.BEFORE_REPRESENTATION
, DATAAUDIT.AFTER_REPRESENTATION
, DATAAUDIT.IS_FINANCIAL
, DATAAUDIT.WORKSTATION
, DATAAUDIT.ACTION_TYPE
FROM DB2INST1.DATAAUDIT,
DB2INST1.LOAN,
DB2INST1.ACCOUNT,
DB2INST1.PRODUCT
Where CAST(SUBSTRING(DATAAUDIT.KEY_REPRESENTATION,charindex('=',DATAAUDIT.KEY_REPRESENTATION)+1,(charindex('|',DATAAUDIT.KEY_REPRESENTATION) - charindex('=',DATAAUDIT.KEY_REPRESENTATION)-1)) as BIGINT) = Loan.MEMBER_NBR and
CAST(SUBSTRING(DATAAUDIT.KEY_REPRESENTATION,charindex('=',DATAAUDIT.KEY_REPRESENTATION,charindex('=',DATAAUDIT.KEY_REPRESENTATION)+1)+1,LEN(DATAAUDIT.KEY_REPRESENTATION)) AS BIGINT) = Loan.LOAN_NBR and
Loan.MEMBER_NBR = ACCOUNT.MEMBER_NBR and
Loan.LOAN_NBR = ACCOUNT.ACCOUNT_NBR and
ACCOUNT.PRODUCT_CODE = PRODUCT.PRODUCT_CODE and
ACCOUNT.PRODUCT_CATEGORY_CODE = PRODUCT.PRODUCT_CATEGORY_CODE
and ACCOUNT.PRODUCT_CLASS_CODE = PRODUCT.PRODUCT_CLASS_CODE and
Table_Name = 'Loan'