title: DBMS_METADATA.GET_DDL Fails even though I have SELECT_CATALOG_ROLE?
body: <p>I get this error  </p>
  
  <pre><code>java.sql.SQLException: ORA-31603: object "XXX" of type TRIGGER not found in schema "YYYY"
  ORA-06512: at "SYS.DBMS_METADATA", line 6069
  ORA-06512: at "SYS.DBMS_METADATA", line 8666
  ORA-06512: at line 1
  </code></pre>
  
  <p>when trying to get the sql for triggers using the following sql.</p>
  
  <pre><code>SELECT
  s.OWNER AS SCHEMA,
  s.object_name AS NAME,
  dbms_metadata.get_DDL(s.object_type,s.object_name,s.owner) AS "SQL"
  FROM SYS.DBA_OBJECTS s
  WHERE s.OBJECT_TYPE IN ('TRIGGER')
  </code></pre>
  
  <p>I have the following USER_ROLE_PRIVS: SELECT_CATALOG_ROLE<br>
  <a href="https://i.stack.imgur.com/1vzgu.png" rel="nofollow noreferrer">USER_ROLE_PRIVS</a></p>
  
  <p>DB VERSION:</p>
  
  <pre><code>Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
  PL/SQL Release 12.1.0.2.0 - Production
  "CORE    12.1.0.2.0    Production"
  TNS for IBM/AIX RISC System/6000: Version 12.1.0.2.0 - Production
  NLSRTL Version 12.1.0.2.0 - Production
  </code></pre>
  
  <p>I've tried figure out what is wrong but I have come to a dead end. 
  Everywhere I search it says that all I need is SELECT_CATALOG_ROLE unless I am running this inside a procedure. 
  I am running the sql through a JDBC connection, however I still get the error even if I am running it using a sql client.</p>
  
  <p>Please let me know if you need to know any other permissions that I have. I already know of the workaround to use DBA_SOURCE, I just need to understand why I can't use get_DDL since  according to the oracle docs I only need to have SELECT_CATALOG_ROLE to be able to use it.</p>
  
  <p>EDIT: A few notes.<br>
  This query has been working correctly when scanning other databases I don't know why this is not working on this environment.<br>
  I don't want to use DBA_SOURCE since it omits some statements such as 'create trigger' and I want to use the available functions instead of doing manual manipulations. (However if no one can figure out why this is happening I will have to go back to using DBA_SOURCE)<br>
  The query has an owner filter I didn't add it here since I wanted to present the problem without any other unnecessary information</p>