如何在SQL * Plus中获取Oracle create table语句 [英] How to get Oracle create table statement in SQL*Plus

查看:195
本文介绍了如何在SQL * Plus中获取Oracle create table语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个存在于Oracle数据库中的表,但是没有显示在SQL Developer工具的表列表中.但是,如果我转到SQL * Plus,然后执行

I have a table that exists in an Oracle database, but doesn't show on my list of tables in the tool SQL Developer. However, if I go to SQL*Plus, and do a

select table_name from user_tables;

我得到列出的表.如果我输入

I get the table listed. If I type

desc snp_clearinghouse;

它向我显示了这些字段.我想获取create语句,因为我需要添加一个字段.我可以修改表以添加字段,但是我仍然需要create语句放入我们的源代码管理中.哪个pl/sql语句用于获取表的create语句?

it shows me the fields. I'd like to get the create statement, because I need to add a field. I can modify the table to add the field, but I still need the create statement to put into our source control. What pl/sql statement is used to get the create statement for a table?

推荐答案

来自获取表和索引DDL简单的方法:

set heading off;
set echo off;
Set pages 999;
set long 90000;

spool ddl_list.sql

select dbms_metadata.get_ddl('TABLE','DEPT','SCOTT') from dual;

select dbms_metadata.get_ddl('INDEX','DEPT_IDX','SCOTT') from dual;

spool off;

这篇关于如何在SQL * Plus中获取Oracle create table语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆