sql >> Base de Datos >  >> RDS >> Oracle

Asistencia para reemplazar las uniones de Oracle (+) por uniones ANSI

Creo que esto lo hará:

SELECT
  AUP.USERNAME,
  AUP.MENU_STRING MODULE,
  NVL(UGA.PERMISSION,AUP.DEFAULT_PERMISSION) PERMISSION
FROM
  (SELECT
    DU.USERNAME,
    A.PROGRAM_ID,
    A.MENU_STRING,
    'Y' DEFAULT_PERMISSION
  FROM
    APPLICATION A,
    DBA_USERS DU
  WHERE 
    A.PROGRAM_ID NOT IN ('.SEPARATOR')
    AND DU.USERNAME NOT LIKE '%#') AUP
LEFT JOIN
  (SELECT
    USER_ID,
    PROGRAM_ID,
    PERMISSION
  FROM
    USER_PGM_AUTHORITY
  WHERE
    PROGRAM_COMPONENT='PROGRAM') UGA
ON
  AUP.USERNAME=UGA.USER_ID
  AND AUP.PROGRAM_ID=UGA.PROGRAM_ID
WHERE
  aup.menu_string = 'Vendor Maintenance'
ORDER BY
  AUP.USERNAME,
  AUP.MENU_STRING;