Posts

Showing posts from March, 2017

Generating XML using DBMS_XMLGEN

DBMS_XMLGEN  Oracle package is used to convert the result of sql query to a XML format and returns it as a CLOB . First, Create a sql as below. stmt_   VARCHAR2(32000) ;  ctx_    dbms_xmlgen.ctxHandle; xml_    XmlType; role_   VARCHAR2(20) := 'ENDUSER'; stmt_ := 'SELECT                t.role,                t.description,                t.created CREATED_DATE,                CURSOR(SELECT grant_id                         FROM system_grant_tab                         WHERE role ='''|| role_||'''                         ORDER BY nlssort(grant_id, ''nls_sort=binary'')) SYSTEM_GRANTS     F...