{"id":352,"date":"2014-05-18T21:12:12","date_gmt":"2014-05-19T02:12:12","guid":{"rendered":"https:\/\/bijoos.com\/oraclenotes\/?p=352"},"modified":"2026-02-07T15:34:45","modified_gmt":"2026-02-07T21:34:45","slug":"two-cool-utilities-in-dbms_utility","status":"publish","type":"post","link":"https:\/\/bijoos.com\/oraclenotes\/2014\/352\/","title":{"rendered":"Two Cool Utilities in DBMS_UTILITY"},"content":{"rendered":"<p>Oracle Database DBMS_UTILITY package has several useful subprograms. GET_DEPENDENCY shows the objects depended on the object. Here is an example (the procedure uses DBMS_OUTPUT to show the result, hence SET SERVEROUTPUT is required in SQL*Plus):<\/p>\n<pre class=\"lang:default highlight:0 decode:true\">SQL&gt; set serveroutput on\nSQL&gt; exec dbms_utility.get_dependency('VIEW','HR','EMP_DETAILS_VIEW');\n-\nDEPENDENCIES ON HR.EMP_DETAILS_VIEW\n------------------------------------------------------------------\n*VIEW HR.EMP_DETAILS_VIEW()\n\nPL\/SQL procedure successfully completed.\n\nSQL&gt; exec dbms_utility.get_dependency('TABLE','HR','EMPLOYEES');\n-\nDEPENDENCIES ON HR.EMPLOYEES\n------------------------------------------------------------------\n*TABLE HR.EMPLOYEES()\n    VIEW HR.EMP_DETAILS_VIEW()\n    TRIGGER HR.SECURE_EMPLOYEES()\n    TRIGGER HR.UPDATE_JOB_HISTORY()\n\nPL\/SQL procedure successfully completed.\n\nSQL&gt;<\/pre>\n<p>Oracle Database 12c has a new procedure\u00a0to provide you with the SQL behind the SQL. DBMS_UTILITY.EXPAND_SQL_TEXT. Useful to expand the views and see the base tables involved, as well as to reveal the real SQL, especially when clauses like &#8220;FETCH and OFFSET&#8221; are used.<\/p>\n<p>There are two CLOB parameters to this procedure &#8211; input SQL text, and output SQL text. Try this in your Oracle Database 12c&#8230;<\/p>\n<pre class=\"lang:default highlight:0 decode:true\">SQL&gt; set long 32000\nSQL&gt; variable x1 CLOB\nSQL&gt; exec dbms_utility.expand_sql_text('SELECT TABLE_NAME FROM DBA_TABLES',:x1);\nSQL&gt; print x1<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Oracle Database DBMS_UTILITY package has several useful subprograms. GET_DEPENDENCY shows the objects depended on the object. Here is an example (the procedure uses DBMS_OUTPUT to show the result, hence SET SERVEROUTPUT is required in SQL*Plus): SQL&gt; set serveroutput on SQL&gt; exec dbms_utility.get_dependency(&#8216;VIEW&#8217;,&#8217;HR&#8217;,&#8217;EMP_DETAILS_VIEW&#8217;); &#8211; DEPENDENCIES ON HR.EMP_DETAILS_VIEW &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; *VIEW HR.EMP_DETAILS_VIEW() PL\/SQL procedure successfully completed. SQL&gt; exec &#8230; <a title=\"Two Cool Utilities in DBMS_UTILITY\" class=\"read-more\" href=\"https:\/\/bijoos.com\/oraclenotes\/2014\/352\/\" aria-label=\"Read more about Two Cool Utilities in DBMS_UTILITY\">Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[133],"tags":[],"class_list":["post-352","post","type-post","status-publish","format-standard","hentry","category-oracledb"],"acf":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/bijoos.com\/oraclenotes\/wp-json\/wp\/v2\/posts\/352","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bijoos.com\/oraclenotes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bijoos.com\/oraclenotes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bijoos.com\/oraclenotes\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bijoos.com\/oraclenotes\/wp-json\/wp\/v2\/comments?post=352"}],"version-history":[{"count":1,"href":"https:\/\/bijoos.com\/oraclenotes\/wp-json\/wp\/v2\/posts\/352\/revisions"}],"predecessor-version":[{"id":3022,"href":"https:\/\/bijoos.com\/oraclenotes\/wp-json\/wp\/v2\/posts\/352\/revisions\/3022"}],"wp:attachment":[{"href":"https:\/\/bijoos.com\/oraclenotes\/wp-json\/wp\/v2\/media?parent=352"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bijoos.com\/oraclenotes\/wp-json\/wp\/v2\/categories?post=352"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bijoos.com\/oraclenotes\/wp-json\/wp\/v2\/tags?post=352"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}