缺少等号

时间:2018-07-31 11:41:56

标签: oracle plsql

以下代码以ORA-00927: missing equal sign失败:

if (countExceed > 0) then 
    quer :=
        'Update UID_RM_HIERARCHY I
            SET I.REVIEWER_UID IN
            (
                SELECT L.REVIEWER_UID
                  FROM UID_RM_HIERARCHY L
                 WHERE L.UNIQUE_ID  in (' || p_ID_list || ')
            )
      WHERE I.REVIEWER_UID in('||p_ID_list||')
        AND I.isdeleted=0';

    EXECUTE IMMEDIATE quer;

我应该更改些什么来解决它?

1 个答案:

答案 0 :(得分:0)

要运行代码,您可以执行以下操作:

if (countExceed > 0) then 
    quer :=
        'Update UID_RM_HIERARCHY I
            SET I.REVIEWER_UID = -- place always a "=" and no "IN"
            (
                SELECT L.REVIEWER_UID
                  FROM UID_RM_HIERARCHY L
                 WHERE L.UNIQUE_ID  in (' || p_ID_list || ')
                   AND ROWNUM = 1 -- This query has to give you a single value! Because of this we only select the first value (properbly wrong?!)
            )
      WHERE I.REVIEWER_UID in('||p_ID_list||')
        AND I.isdeleted=0';

    EXECUTE IMMEDIATE quer;

但是我强烈建议您阅读一些教程。或明确说明您在做什么。我仍然不确定您正在使用那些p_ID_list或它包含的内容。

要获得进一步的帮助,您应该告诉我们:

  • 你的桌子是什么?
  • 它们包含什么?
  • p_ID_list包含什么?
  • 您将如何逐步处理列表?