-1

EM でレポートを作成していますが、ここで何かを把握する必要があります

私が作成したこのクエリがあります:

SELECT
*
FROM
(
    SELECT DISTINCT
    patch.host as "PHost",
    patch.home_location as "PDirectory",
    patch.home_name as "PHome",
    MAX(patch.INSTALLATION_TIME) as "Patched (Date)",
    MAX(patch.PATCH_RELEASE) as "PVersion",
    listagg(patch,',') WITHIN GROUP (ORDER BY patch) "Patches"
    FROM
    mgmt$applied_patches patch
    GROUP BY patch.host, patch.home_location,patch.home_name
    ORDER BY patch.host, patch.home_location
) "PCH",
(
    SELECT DISTINCT 
    T1.PROPERTY_VALUE as "MHost",
    T2.PROPERTY_VALUE as "MDirectory",
    T3.PROPERTY_VALUE as "MVersion",
    count(T4.PROPERTY_VALUE) as "Count of SID",
    listagg(T4.PROPERTY_VALUE,',') WITHIN GROUP (ORDER BY T4.PROPERTY_VALUE) as "SID"
    FROM
    MGMT$TARGET_PROPERTIES T1,
    MGMT$TARGET_PROPERTIES T2,
    MGMT$TARGET_PROPERTIES T3,
    MGMT$TARGET_PROPERTIES T4
    WHERE
    T1.TARGET_GUID = T2.TARGET_GUID
    and T1.TARGET_GUID = T3.TARGET_GUID
    and T1.TARGET_GUID = T4.TARGET_GUID
    and T1.PROPERTY_NAME = 'MachineName'
    and T2.PROPERTY_NAME = 'OracleHome'
    and T3.PROPERTY_NAME = 'Version'
    and T4.PROPERTY_NAME = 'SID'
    GROUP BY T1.PROPERTY_VALUE, T2.PROPERTY_VALUE, T3.PROPERTY_VALUE
) "MGM"
WHERE
PDirectory = MDirectory

エラー ORA-00904 が表示されます: "MDIRECTORY":....

いろいろ組み合わせてみました!(PCH.PDirectory = MGM.MDirectory, ......) 何も機能しません

乾杯

4

2 に答える 2

2

Oracle で大文字と小文字が混在する名前は忌まわしいものです。

使用する:

"PDirectory" = "MDirectory"

.. またはより良いのは、引用符が必要な特別な名前を使用しないことです。

于 2012-05-31T10:43:09.153 に答える
1

良い...

これは機能しません:

SELECT * FROM
(SELECT DUMMY AS  "PDirectory" FROM DUAL) "PCH",
(SELECT DUMMY AS  "MDirectory" FROM DUAL) "MGR"
WHERE PDIRECTORY = MDIRECTORY

しかし、これは機能します:

SELECT * FROM
(SELECT DUMMY AS  "PDirectory" FROM DUAL) "PCH",
(SELECT DUMMY AS  "MDirectory" FROM DUAL) "MGR"
where "PCH"."PDirectory" = "MGR"."MDirectory"

それに応じてクエリを変更してください。

于 2012-05-31T10:43:13.777 に答える