0

它不起作用,我只收到错误 ORA-00913:“值太多。”。

我认为问题在于嵌套选择。我想用这个选择来查看。

此代码显示所有员工的报告。我更改了这篇文章的属性名称:

 SELECT sk."AAAA", sk."BBBB", sk."CCCC", sk."DDD",
          sk."EEEE", sk."FFFF", sk."GGGGG",
          sk."HHHHH",
          (SELECT f.VALUE
           FROM fnd_user_property_tab f
           WHERE f.identity = sk.login
           AND NAME = 'IIIII') iii,sk."JJJJ",

           (SELECT f.VALUE
           FROM fnd_user_property_tab f
           WHERE f.identity = sk.login
           AND NAME = 'SMTP_MAIL_ADDRESS') mail,

           (SELECT f.VALUE
            FROM fnd_user_property_tab f
            WHERE f.identity = sk.login 
            AND NAME = 'KKKK') kkkk,

            (SELECT fnd.ORACLE_ROLE
             FROM fnd_user_role_tab fnd
             WHERE fnd.identity = sk.login
             AND fnd.ORACLE_ROLE LIKE 'STH-%') profil,

             (SELECT dr.ROLE, sox_co_w_roli(dr.role) skład
              FROM sys.dba_roles dr
              WHERE dr.role = (SELECT fnd.ORACLE_ROLE
                              FROM fnd_user_role_tab fnd
                              WHERE fnd.identity = sk.login  
                              AND fnd.ORACLE_ROLE LIKE 'STH-%')
             ) profile_role
    FROM sox_konta sk
    WHERE("PROFIL_DB" LIKE '%ppppp%'
          OR "PROFIL_DB" = 'oooooooo'
          OR "PROFIL_DB" = 'rrrrrrrr'
          )
    AND "COMPANIES" IN ('ZZ; ', 'YY; ')
4

2 回答 2

2

尝试以这种方式重写您的选择

SELECT sk."AAAA", sk."BBBB", sk."CCCC", sk."DDD",
          sk."EEEE", sk."FFFF", sk."GGGGG",
          sk."HHHHH",
          f_iii.value iii, sk."JJJ",
          f_mail.value mail,
          f_kkk.value kkk,
          fnd.oracle_role profil,
          dr.ROLE, sox_co_w_roli(dr.role) skład
    FROM sox_konta sk,
         fnd_user_property_tab f_iii,
         fnd_user_property_tab f_mail,
         fnd_user_property_tab f_kkk,
         fnd_user_role_tab fnd,
         sys.dba_roles dr
    WHERE("PROFIL_DB" LIKE '%ppppp%'
          OR "PROFIL_DB" = 'oooooooo'
          OR "PROFIL_DB" = 'rrrrrrrr'
          )
        AND "COMPANIES" IN ('ZZ; ', 'YY; ')
        AND f_iii.identity = sk.login
        AND f_iii.NAME = 'IIIII'
        AND f_mail.identity = sk.login
        AND f_mail.NAME = 'SMTP_MAIL_ADDRESS'
        AND f_kkk.identity = sk.login
        AND f_kkk.NAME = 'KKKK'
        AND fnd.identity = sk.login
        AND fnd.ORACLE_ROLE LIKE 'STH-%'
        AND dr.role = fnd.ORACLE_ROLE;

我认为这会有所帮助。

于 2012-11-16T08:18:17.523 回答
1

从这件作品开始。你收到错误了吗?是的?您需要更改为iii提供值的子查询,以便它只返回一行。

如果此段未返回错误,则添加下一段,直到您确定导致错误的原因。

SELECT sk."AAAA", sk."BBBB", sk."CCCC", sk."DDD",
      sk."EEEE", sk."FFFF", sk."GGGGG",
      sk."HHHHH",
      (SELECT f.VALUE
       FROM fnd_user_property_tab f
       WHERE f.identity = sk.login
       AND NAME = 'IIIII') iii
FROM sox_konta sk
WHERE("PROFIL_DB" LIKE '%ppppp%'
      OR "PROFIL_DB" = 'oooooooo'
      OR "PROFIL_DB" = 'rrrrrrrr'
      )
AND "COMPANIES" IN ('ZZ; ', 'YY; ')
于 2012-11-16T10:22:35.027 回答