0 - 4 of 4 tags for bad character

Hi All,
Is there any way to identify the exact line number or SQL code which is throwing "SELECT Failed. 2620:  The format or data contains a bad character." issue?

I have an unusual sitution. The below query works when I don't refer to any of the fields in the 'product_table'.
If I leave the product table join in it still works so it's not an issue with the join.

I keep getting the above error message after the query below has been running for a minute or so.

I looked at this part...

left join (select CCT_External_ID, CCT_Agent_ID from GDW_VIEWS. CCT_AGENT where CCT_External_ID between '0' and '999999') Rep_Trans_IDs on Rep_Emp_IDs.emp_id=Rep_Trans_IDs.CCT_External_ID


SELECT TRIM((CASE WHEN mt.Store_state IS NULL THEN '#@@#' ELSE mt.Store_state END)) as Store_State

,TRIM((CASE WHEN mt.Company_Cd IS NULL THEN '#@@#' ELSE mt.Company_Cd END)) as Company_Cd
,TRIM((CASE WHEN mt.Sales_Org_Cd IS NULL THEN '#@@#' ELSE mt.Sales_Org_Cd END)) as Sales_Org_Cd
,TRIM((CASE WHEN mt.Fiscal_Period IS NULL THEN '#@@#' ELSE mt.Fiscal_Period END)) as Fiscal_Period
,TRIM((CASE WHEN mt.Fiscal_Year IS NULL THEN '#@@#' ELSE mt.Fiscal_Year END)) as Fiscal_Year