使用查询获取VIEW DDL

编程入门 行业动态 更新时间:2024-10-27 23:24:14
本文介绍了使用查询获取VIEW DDL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

对于数据库重新架构,我需要获取每个表的DDL并在数据库(Oracle)中进行查看.我不想转到每个表/视图的属性并在SQL Developer中从中获取SQL.

For database re-architecture I need to get DDL of each table and view in the database(Oracle). I don't want to go to property of each table/view and get SQL out of it in SQL Developer.

我成功使用表获得了DDL-

I successfully got DDL for table using-

select dbms_metadata.get_ddl('TABLE','Table_name','Schema_Name') from dual;

但是面对VIEW和MVIEW的问题.任何人都可以为表格以外的元素提供命令/关键字.

But facing problem with VIEW and MVIEW. Could anyone provide commands/keywords for elements other than table.

此外,我想将结果导出到excel文件中,第一列为TableName,第二列为DDL.

Also, I want to export the result in an excel file with first column as TableName and second column as DDL.

推荐答案

尝试通过以下查询获取视图:

Try the below query for view:

select text from ALL_VIEWS where upper(view_name) like upper(<view_name>);

对于mviews:

select query from ALL_MVIEWS where upper(mview_name) like upper(<mview_name>);

更多推荐

使用查询获取VIEW DDL

本文发布于:2023-10-28 23:55:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1538134.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:VIEW   DDL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!