SQL命令没有正确结束


SELECT /*+ PARALLEL(aae,4) */ DISTINCT nvl(aae.voucher_group_id,-1)  voucher_group_id,
                           aae.nominal_transaction_amount unit_price,
                           aae.original_currency_type currency_type,
                           aae.segmentation_id
             FROM air_account_events aae
            WHERE aae.time_hour_id >= m_start_thid
              AND aae.time_hour_id < m_end_thid
              AND aae.nominal_transaction_amount is not null 
           MINUS
           SELECT vg.voucher_group_id,
                  vg.unit_price,
                  vg.currency_type,
                  vg.segmentation_id
             FROM wh_voucher_groups_dim vg) ahm
    ON (whm.voucher_group_id = ahm.voucher_group_id AND whm.unit_price = ahm.unit_price 
    AND whm.currency_type = ahm.currency_type AND whm.segmentation_id=ahm.segmentation_id) ahm

当我运行以下PL/SQL时,出现错误

         FROM wh_voucher_groups_dim vg) ahm
                                      *

第14行出现错误:ORA-00933: SQL命令没有正确结束

请告诉我哪里有错误,请告诉我如何修改


这一行缺少一个JOIN条件:

FROM wh_voucher_groups_dim vg) ahm
   JOIN ???????
   ON (whm.voucher_group_id ....

编辑:根据你下面的评论…你可能在找这个…?您需要在大括号中包含完整的内部Query,给它一个别名,然后将其连接到另一个表。没有必要使用"USING"

select * from wh_voucher_groups_dim whm,
( SELECT /*+ PARALLEL(aae,4) */ 
         DISTINCT nvl(aae.voucher_group_id,-1)  voucher_group_id,
                           aae.nominal_transaction_amount unit_price,
                           aae.original_currency_type currency_type,
                           aae.segmentation_id
             FROM air_account_events aae
            WHERE aae.time_hour_id >= m_start_thid
              AND aae.time_hour_id < m_end_thid
              AND aae.nominal_transaction_amount is not null 
           MINUS
           SELECT vg.voucher_group_id,
                  vg.unit_price,
                  vg.currency_type,
                  vg.segmentation_id
             FROM wh_voucher_groups_dim vg
 ) ahm
    WHERE  (whm.voucher_group_id = ahm.voucher_group_id AND 
            whm.unit_price = ahm.unit_price AND
            whm.currency_type = ahm.currency_type AND 
            whm.segmentation_id=ahm.segmentation_id)

你可能有一个ANSI连接语法之前,你删除了这部分在第二个查询?

SELECT vg.voucher_group_id,
                  vg.unit_price,
                  vg.currency_type,
                  vg.segmentation_id
             FROM wh_voucher_groups_dim vg) ahm
    ON (whm.voucher_group_id = ahm.voucher_group_id AND 
        whm.unit_price = ahm.unit_price AND
        whm.currency_type = ahm.currency_type AND  
        whm.segmentation_id=ahm.segmentation_id) ahm

FROM wh_voucher_groups_dim vg) ahm(交通和。Voucher_group_id = ahm。voucher_group_id AND

这里是否有另一个表别名?

为了使用ON关键字,需要在它前面加一个连接。我在下面添加了JOIN关键字。您需要自己决定是否需要标准连接,外部连接,内部连接等。

             FROM wh_voucher_groups_dim vg) ahm JOIN <table>
    ON (whm.voucher_group_id = ahm.voucher_group_id AND whm.unit_price = ahm.unit_price 
    AND whm.currency_type = ahm.currency_type AND whm.segmentation_id=ahm.segmentation_id) ahm 

我猜这是一个更大的查询的一部分,不知何故开始部分被删除了:

SELECT ...                  --- missing part
FROM ...                    --- missing part
    sometable whm           --- missing part
        SOME JOIN           --- missing part
    (                       --- missing part
      SELECT /*+ PARALLEL(aae,4) */ DISTINCT ...
      ...
      FROM wh_voucher_groups_dim vg
    ) ahm
      ON ( whm.voucher_group_id = ahm.voucher_group_id 
       AND whm.unit_price = ahm.unit_price 
       AND whm.currency_type = ahm.currency_type 
       AND whm.segmentation_id=ahm.segmentation_id
         )

相关内容

  • 没有找到相关文章

最新更新