1)获得表、索引、视图、存储过程、函数的DDL select dbms_metadata.get_ddl('TABLE','TABLE_NAME','TABLE_OWNER') from dual; select dbms_metadata.get_ddl('INDEX','INDEX_NAME','INDEX_OWNER') from dual; select dbms_metadata.get_ddl('VIEW','VIEW_NAME','VIEW_OWNER') from dual; select dbms_...
DBMSMETADATA.GETDDL包可以得到数据库的对象的ddl脚本。如下SQLPLUS中执行:1.得到一个表的ddl语句:SET SERVEROUTPUT ONSET LINESIZE 1000SET FEEDBACK OFFset
select dbms_metadata.get_granted_ddl('OBJECT_GRANT', dtp.grantee) AS DDL_SCRIPT from dba_tab_privs dtp where dtp.grantee = 'TYPE_USER_NAME' and rownum = 1 union all select dbms_metadata.get_granted_ddl('DEFAULT_ROLE', drp.grantee) AS DDL_SCRIPT from dba_role_privs drp where drp.gran...
select dbms_metadata.get_ddl('FUNCTION','FUNCTIONNAME','USERNAME') from dual; 12.查看包定义 select dbms_metadata.get_ddl('PACKAGE','PACKAGENAME','USERNAME') from dual 13.查看存储过程定义 select dbms_metadata.get_ddl('PROCEDURE','PROCEDURENAME','USERNAME') from dual 14.查看权限的定义 select...
DBMS_METADATA.GET_DDL包可以得到数据库的对象的ddl脚本。如下(SQLPLUS中执行): 1.得到一个表的ddl语句: SET SERVEROUTPUT ON SET LINESIZE 1000 SET FEEDBACK OFF set long 999999 ---显示不完整 SET PAGESIZE 1000 ---分页 EXECUTE DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'STORAGE...
EXECUTE DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'STORAGE',false); ---去除storage等多余参数 SELECT DBMS_METADATA.GET_DDL('TABLE','TCC_NE_FRAME') FROM DUAL; SELECT DBMS_METADATA.GET_DDL('TABLE','TCC_NE_SNAP') FROM DUAL; ...
dbms_metadata.get_ddl的使用总结,日常工作中,经常有人通过工具去查看对象的定义,其实有时候这样去查看也很烦的。在工作中,也有同事问我怎么获取对象定义,今天我做个总结给大家,希望对大家有所帮助!获取对象定义的包为:dbms_metadata,其中的get_ddl函数是获取对象
_METADATA.GET_DDL('VIEW',view_name)FROMuser_views;-- 得到一个用户下的所有表,索引,存储过程,函数的ddlSELECTDBMS_METADATA.GET_DDL(U.OBJECT_TYPE,u.object_name)FROMUSER_OBJECTS uwhere U.OBJECT_TYPEIN('TABLE','INDEX','PROCEDURE','FUNCTION');-- 查看当前用户表的SQLselectdbms_metadata.get_ddl...
[Oracle]dbms_metadata.get_ddl的使⽤⽅法总结dbms_metadata.get_ddl()⽤于获取对象的DDL,其具体⽤法如下。复制代码代码如下:set line 200 set pagesize 0 set long 99999 set feedback off set echo off 复制代码代码如下:select dbms_metadata.get_ddl('TABLE','TABLE_NAME','TABLE_OWNER') from ...
select dbms_metadata.get_ddl('REF_CONSTRAINT','CONSTRAINT_NAME') from dual SQL> select dbms_metadata.get_ddl('REF_CONSTRAINT','FK_DEPTNO') from dual; ALTER TABLE "SCOTT"."EMP" ADD CONSTRAINT "FK_DEPTNO" FOREIGN KEY ("DEPTNO")REFERENCES "SCOTT"."DEPT" ("DEPTNO") ENABLE ...