How to get Oracle create table statement in SQL*Plus(如何在 SQL*Plus 中获取 Oracle 创建表语句)
问题描述
我有一个存在于 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 创建表语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在 SQL*Plus 中获取 Oracle 创建表语句


基础教程推荐
- 什么是 orradiag_<user>文件夹? 2022-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
- 在多列上分布任意行 2021-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- oracle区分大小写的原因? 2021-01-01