amazon-redshift - 错误:无法匹配 UNION 类型整数和字符变化 [SQL 状态 = 42804]
问题描述
我正在合并两个视图,但超出了错误。请帮我解决这个问题。一些值在那里被硬编码,需要在最终视图中提取相同的值。我在 redshift 中使用以下查询-
询问:
DROP VIEW IF EXISTS jgbl.vw_jgvcc_crm_case_activity CASCADE;
CREATE OR REPLACE VIEW jgbl.vw_jgvcc_crm_case_activity
AS
SELECT case_number as "CASE Number",
parent_case_number as "Parent Case Number",
date_opened as "Date Opened",
number_of_questions as "Number of Questions",
case_record_type as "CASE Record Type",
NULL as "Sub Type",
category as "Category",
NULL as "Sub Category",
country as Country,
customer_type as "Customer Type",
primary_account_subtype as "Primary Account Subtype",
source as Source,
call_center_location as "Call Center Location",
region as Region,
customer_region as "Customer Region",
NULL as "AE",
NULL as "PQC",
'ASPAC' as datasource
FROM JG_ASPAC.vw_jgvcc_aspac_crm_activity
UNION ALL
SELECT case_num as "CASE Number",
NULL as "Parent Case Number",
open_dt as "Date Opened",
cast(num_of_ques as integer) as "Number of Questions",
rec_type_nm as "CASE Record Type",
rec_sub_type as "Sub Type",
cat_desc as "Category",
sctgy_desc as "Sub Category",
custm_latam_ctry_nm as Country,
acct_type as "Customer Type",
NULL as "Primary Account Subtype",
src_in as Source,
case when alph_fl='Y' then 'Alphanumeric' else 'LATAM Center' end as "Call Center Location",
'LATAM' as Region,
NULL as "Customer Region",
Case when rec_type_nm='AE/PQC' and rec_sub_type in ('ADVERSE EVENT','AE + PQC') then 'Y' else 'N' End as "AE",
Case when rec_type_nm='AE/PQC' and rec_sub_type in ('AE + PQC', 'PRODUCT QUALITY COMPLAINT') then 'Y' else 'N' End as "PQC",
'LATAM' as datasource
FROM JG_LTM.vw_jgvcc_latam_crm_activity as v2
--LEFT JOIN jgbl.dim_iso_reg_cntry as t1 on t1.region = v2.ctry_iso2_cd
with no schema binding;
错误:
执行SQL命令时出错:select * from jgbl.vw_jgvcc_crm_case_activity limit 10
错误:无效数字,值“。”,位置 1,类型:整数详细信息:
错误:无效数字,值'.',位置 1,类型:整数代码:1207 上下文:1.0 查询:87576 位置:0 进程:query1_562_87576 [pid=0] ------------- ---------------------------------- [SQL State=XX000] 1 条语句失败。
执行时间:4.81s
解决方案
推荐阅读
- java - 是公共消费者
> consumer() {...} Kafka Ktable 的有效 spring scs 定义? - wso2 - 如何在 WSO2 API Manager 3.2.0 上启用 SCIM2
- python - Python 错误“调用 Python 对象时超出最大递归深度”
- linux - 是否可以读取文件并将缓冲区直接存储到共享内存中?
- git - Github 显示的提交者名称不是我的用户名
- javascript - 在关闭事件时清除 Angular DropDownList 数组
- dataframe - 使用 Dask 阅读时如何按日期时间列过滤 Parquet 文件?
- css - 你如何将 React Native Gifted Chat 移到屏幕上?
- javascript - 如何在 redux (RFC) 中使用订阅多个 reducer?
- mongodb - 如何用 mongodb 中的新文档替换旧的所有文档?