为什么我的Transaction Fact表生成ORA-00920:无效的关系运算符错误?

时间:2018-05-16 21:24:52

标签: oracle oracle-apex

我是Oracle的新手并且发布了下面的代码,我的维度表都已正确插入,只是这个事实表导致了我这个问题。任何帮助将非常感激。谢谢

INSERT INTO Transaction_Fact
(TermID, ResourceID, CampusID, SubjectID, MaxBooksOwned, Year, TotalBorrowed, FinesTotal) 
SELECT 1, '001', 'PK', 'TC001', 5, 2017, SUM(ResourceID * isReturned), 6
 FROM tbl_Resources1a
 INNER JOIN tbl_ResourceReturn1a
    ON tbl_Resources1a.ResourceID, tbl_ResourceReturn1a.ResourceID
    INNER JOIN tbl_Term
    ON tbl_ResourceReturn1a.TermID, tbl_Term1a.TermID
    WHERE Year >= TO_DATE('2017/01/01', 'yyyy/dd/mm')
    AND   Year <= TO_DATE('2018/01/31', 'yyyy/dd/mm')
    GROUP BY tbl_Resources1a.TermID

ORA-00920:无效的关系运算符

1 个答案:

答案 0 :(得分:0)

因为逗号不是有效的关系运算符(a.k.a comparison condition)。您的ON条款应该(可能)正在测试相等性:

 INNER JOIN tbl_ResourceReturn1a
    ON tbl_Resources1a.ResourceID = tbl_ResourceReturn1a.ResourceID
 INNER JOIN tbl_Term
    ON tbl_ResourceReturn1a.TermID = tbl_Term1a.TermID