Answers for "oracle get ddl view"

SQL
1

oracle get_ddl

-- DDL object_type
SELECT OWNER,
       OBJECT_TYPE,
       decode(object_type,
              'DATABASE LINK', 'DB_LINK',
              'JOB', 'PROCOBJ',
              'RULE SET', 'PROCOBJ',
              'RULE', 'PROCOBJ',
              'EVALUATION CONTEXT', 'PROCOBJ',
              'CREDENTIAL', 'PROCOBJ',
              'CHAIN', 'PROCOBJ',
              'PROGRAM', 'PROCOBJ',
              'PACKAGE', 'PACKAGE_SPEC',
              'PACKAGE BODY', 'PACKAGE_BODY',
              'TYPE', 'TYPE_SPEC',
              'TYPE BODY', 'TYPE_BODY',
              'MATERIALIZED VIEW', 'MATERIALIZED_VIEW',
              'QUEUE', 'AQ_QUEUE',
              'JAVA CLASS', 'JAVA_CLASS',
              'JAVA TYPE', 'JAVA_TYPE',
              'JAVA SOURCE', 'JAVA_SOURCE',
              'JAVA RESOURCE', 'JAVA_RESOURCE',
              'XML SCHEMA', 'XMLSCHEMA',
              object_type
           ) AS object_type_ddl
FROM DBA_OBJECTS;
-- DDL of object depending on object_type_ddl
SELECT dbms_metadata.get_ddl('object_type_ddl', 'obj_name', 'schema_name') 
	FROM DUAL;
Posted by: Guest on August-24-2021
5

oracle get ddl

-- 4000 characters max
SELECT dbms_metadata.get_ddl('PROCOBJ', 'job_name', 'owner') FROM DUAL;
SELECT dbms_metadata.get_ddl('PROCOBJ', 'program_name', 'owner') FROM DUAL;
SELECT dbms_metadata.get_ddl('TABLE', 'table_name', 'owner') FROM DUAL;
SELECT dbms_metadata.get_ddl('VIEW', 'view_name', 'owner') FROM DUAL;

SELECT dbms_metadata.get_ddl('PACKAGE', 'pkg_name', 'owner') FROM DUAL; 
SELECT dbms_metadata.get_ddl('PROCEDURE', 'proc_name', 'owner') FROM DUAL; 

SELECT dbms_metadata.get_ddl('INDEX', 'index_name', 'owner') FROM DUAL;
SELECT dbms_metadata.get_ddl('TYPE', 'type_name', 'owner') FROM DUAL;
Posted by: Guest on July-16-2021
11

oracle view ddl

-- Views (use USER_VIEWS or DBA_VIEWS if needed):
SELECT TEXT FROM ALL_VIEWS WHERE upper(VIEW_NAME) LIKE upper('%VIEW_NAME%');
-- Or:
SELECT dbms_metadata.get_ddl('VIEW', 'VIEW_NAME', 'OWNER_NAME') FROM DUAL;

-- Materialized views (use USER_VIEWS or DBA_VIEWS if needed):
SELECT QUERY FROM ALL_MVIEWS WHERE upper(MVIEW_NAME) LIKE upper('%VIEW_NAME%');
-- Or:
SELECT dbms_metadata.get_ddl('MATERIALIZED_VIEW', 'VIEW_NAME', 'OWNER_NAME') 
FROM DUAL;
Posted by: Guest on June-14-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language