条件连接与 CASE 语句导致语法错误

问题描述 投票:0回答:0

我基本上想在我有

CASE
语句的下面写一个条件连接,但这会导致语法错误。我基本上只想在
OWNING_ENTITY_ID
等于
ORGANIZATION_ID
时使用这个连接,否则如果它们不匹配那么我不想加入这个。

   SELECT cce.*
   FROM INV_TRANSACTIONS cce, SYSTEM_ITEMS DEF

   WHERE cce.LOCATOR_ID = DEF.LOCATOR_ID
    AND CASE WHEN cce.OWNING_ENTITY_ID = cce.ORGANIZATION_ID
             THEN cce.OWNING_ENTITY_ID = cce.ORGANIZATION_ID 
             END
sql oracle12c
© www.soinside.com 2019 - 2024. All rights reserved.