正如问题所述。每次我尝试创建一个视图时,它都会对我调用它的第一列感到生气,并且无论该列可能是什么,它都会显示“意外的'Column_Name'”。
我是笨蛋还是有其他事情搞砸了?并不是说这些是相互排斥的......
-- Enterprise Factory Data Warehouse : EFDW
-- use appropriate role
USE ROLE EFDW_DEV_DB_DEV;
--USE ROLE EFDW_PROD_DB_DEV;
-- use appropriate Database
USE DATABASE EFDW_DEV_DB;
--USE DATABASE EFDW_PROD_DB;
-- use SUPPLYCHAIN_LOGISTICS schema
USE SCHEMA SUPPLYCHAIN_LOGISTICS;
--------------------------------------------------------------------------------------------------------
---------------------------------------- Information Object creation-------------------------------------------
--------------------------------------------------------------------------------------------------------
-- Demand Data Information Object
CREATE OR REPLACE VIEW SUPPLYCHAIN_LOGISTICS.DEMAND(
MATERIAL_NUM COMMENT 'Material or Part Number',
RSF_INDICATOR COMMENT 'Rough(R), Semi-Finished(S), or Finished(F) Indicator',
SOURCE_PLANT_CODE COMMENT 'Plant code for the sending facility related to SAP',
SOURCE_FACILITY_CODE COMMENT 'Plant code for the sending facility non-SAP',
SOURCE_VALUE_STREAM_CODE COMMENT 'Sending valuestream within the source facility',
PO_NUMBER COMMENT 'Part Order Number',
PO_SCHEDULE_DUE_DATE COMMENT 'Scheduled Due Date for the PO',
SCHEDULED_QUANTITY COMMENT 'Scheduled Quantity of pieces',
SHIP_QUANTITY COMMENT 'Quantity of pieces actually shipped',
RECEIVING_FACILITY_CODE 'Receiving Facility Code',
DATA_SRC COMMENT 'Data Source',
REFRESHED_TS COMMENT 'Refreshed Date. Last time the data was refreshed'
)
COMMENT = 'Data related to future demand'
AS
-- KK LEGACY DEMAND DATA
WITH KK_LEGACY_DEMAND AS (
SELECT
LEGACY_DEMAND.IDENT AS MATERIAL_NUM,
LEGACY_DEMAND.RSF_I AS RSF_INDICATOR,
NULL AS SOURCE_PLANT_CODE,
'CZ' AS SOURCE_FACILITY_CODE,
LEGACY_DEMAND.SCTN AS SOURCE_VALUE_STREAM_CODE,
LEGACY_DEMAND.PO_NBR AS PO_NUMBER,
LEGACY_DEMAND.PO_SCHD_DUE_DT AS PO_SCHEDULE_DUE_DATE,
LEGACY_DEMAND.CUR_SCHD_QTY AS SCHEDULED_QUANTITY,
LEGACY_DEMAND.SHP_QTY AS SHIP_QUANTITY,
LEGACY_DEMAND.RCVG_FAC AS RECEIVING_FACILITY_CODE,
'TBUPRODA_ISS_DMD_SCHD_TBL' AS DATA_SRC,
LEGACY_DEMAND.REFRESHED_TS AS REFRESHED_TS
FROM
EFDL_DEV_DB.DB2.TBUPRODA_ISS_DMD_SCHD_TBL LEGACY_DEMAND
-- EFDL_DROD_DB.DB2.TBUPRODA_ISS_DMD_SCHD_TBL LEGACY_DEMAND
WHERE
LEGACY_DEMAND.PO_SCHD_DUE_DT >= CURRENT_DATE()
AND LEGACY_DEMAND.REL_IND IN ('1', '0')
)
-- KK Legacy MAMM Demand
SELECT
KKLD.MATERIAL_NUM AS MATERIAL_NUM,
KKLD.RSF_INDICATOR AS RSF_INDICATOR,
NULL AS SOURCE_PLANT_CODE,
KKLD.SOURCE_FACILITY_CODE AS SOURCE_FACILITY_CODE,
KKLD.SCTN AS SOURCE_VALUE_STREAM_CODE,
KKLD.PO_NBR AS PO_NUMBER,
KKLD.PO_SCHD_DUE_DT AS PO_SCHEDULE_DUE_DATE,
KKLD.CUR_SCHD_QTY AS SCHEDULED_QUANTITY,
KKLD.SHP_QTY AS SHIP_QUANTITY,
KKLD.RCVG_FAC AS RECEIVING_FACILITY_CODE,
'TBUPRODA_ISS_DMD_SCHD_TBL' AS DATA_SRC,
KKLD.REFRESHED_TS AS REFRESHED_TS
FROM KK_LEGACY_DEMAND KKLD
;
这是我的错误
SQL查询执行期间发生错误
原因:SQL 错误 [1003] [42000]:SQL 编译错误:位置 1 处的语法错误第 2 行意外'MATERIAL_NUM'。