DB2 SQL Союз Борется - PullRequest
       29

DB2 SQL Союз Борется

0 голосов
/ 22 апреля 2020

Привет, это мой первый пост о переполнении стека. Я прочитал много постов, где люди смогли решить свои проблемы, так что здесь. Мне трудно заставить следующий профсоюз работать. Я не уверен, что не так, и сообщение об ошибке от SQL Developer не помогает. Любая помощь в этом с благодарностью!

Я получаю сообщение об ошибке:

"Отчет об ошибке -

DB2 SQL Ошибка: SQLCODE = - 104, SQLSTATE = 42601, SQLERRMC = ""; ECT 'IN' AS STATE;;, DRIVER = 4.7.112 "

Это DDL, который я пытаюсь заставить работать:

CREATE VIEW DW_COE.DAMAGE_FINANCIALS ("STATE"
,"CLAIM_NUMBER"
,"DAMAGE_DATE"
,"LABOR_FEE"
,"EQUIPMENT_FEE"
,"MATERIALS_FEE"
,"MEALS_FEE"
,"CONTRACTED_FEE"
,"POLICE_REPORTS_FEE"
,"GAS_LOSS_FEE"
,"TAXES_FEE"
,"GENERAL_FEE"
,"JO_NO") AS

SELECT DPTS.STATE AS STATE
,Dpts.claim_number AS CLAIM_NUMBER
,DPTS.damagedate AS DAMAGE_DATE
,DPTS.LABOR AS LABOR_FEE
,DPTS.EQUIPMENT AS EQUIPMENT_FEE
,DPTS.MATERIALS AS MATERIALS_FEE
,DPTS.MEALS AS MEALS_FEE
,DPTS.CONTRACTED_FEES AS CONTRACTED_FEE
,DPTS.POLICE_REPORTS AS POLICE_REPORTS_FEE
,DPTS.GAS_LOSS AS GAS_LOSS_FEE
,DPTS.TAXES AS TAXES_FEE
,DPTS.GENERAL AS GENERAL_FEE
,DPTS.JOBORDERNUMBER AS JO_NO
FROM dw_coe.dpts_view DPTS

UNION

SELECT 'IN' AS STATE
,"" AS CLAIM_NUMBER
,"" AS DAMAGE_DATE
,STAR.LABOR AS LABOR_FEE
,STAR.EQUIPMENT AS EQUIPMENT_FEE
,STAR.MATERIAL AS MATERIALS_FEE
,STAR.MEALS AS MEALS_FEE
,STAR.CONTRACTEDFEES AS CONTRACTED_FEE
,STAR.POLICEREPORT AS POLICE_REPORTS_FEE
,STAR.GASLOSS AS GAS_LOSS_FEE
,"" AS TAXES_FEE
,"" AS GENERAL_FEE
,STAR.JOB_ORDER_NUM AS JO_NO
FROM dw_coe.star_view STAR 

UNION

SELECT 'IN' AS STATE
,CAST(GFORMS.REPORT_ID AS VARCHAR(50)) AS CLAIM_NUMBER
,GFORMS.ACCIDENT_DATE AS DAMAGE_DATE
,"" AS LABOR_FEE
,"" AS EQUIPMENT_FEE
,"" AS MATERIALS_FEE
,"" AS MEALS_FEE
,"" AS CONTRACTED_FEE
,"" AS POLICE_REPORTS_FEE
,"" AS GAS_LOSS_FEE
,"" AS TAXES_FEE
,"" AS GENERAL_FEE
,GFORMS.JOB_ORDER_NUMBER AS JO_NO
FROM DDH_GFORMS.DAMAGE_DETAIL GFORMS
WITH UR;

1 Ответ

2 голосов
/ 22 апреля 2020

Двойная кавычка "используется для заключительных идентификаторов (например, имена столбцов)

Одна кавычка 'используется для строковых литералов.

Замените" "на' '

...