Home >Database >Mysql Tutorial >How to Retrieve Table Definitions in Oracle SQL, Equivalent to MySQL's SHOW CREATE TABLE?

How to Retrieve Table Definitions in Oracle SQL, Equivalent to MySQL's SHOW CREATE TABLE?

Susan Sarandon
Susan SarandonOriginal
2025-01-03 11:43:43691browse

How to Retrieve Table Definitions in Oracle SQL, Equivalent to MySQL's SHOW CREATE TABLE?

Equivalent to MySQL's SHOW CREATE TABLE in Oracle SQL

MySQL offers the SHOW CREATE TABLE statement to retrieve the definition of a table. Is there a similar functionality in Oracle SQL?

Oracle SQL Equivalents

SQL*Plus provides the DESC command:

SQL> DESC EMP;

This will display the columns, data types, and other table attributes.

For a pure SQL statement, use the DBMS_METADATA package:

SELECT DBMS_METADATA.GET_DDL('TABLE', 'EMP', 'SCOTT')
FROM DUAL;

This will return the full DDL for the specified table.

Additional Considerations

Some tools may require setting SET LONG 10000 before executing these commands to display LOBs longer than 10,000 bytes.

The above is the detailed content of How to Retrieve Table Definitions in Oracle SQL, Equivalent to MySQL's SHOW CREATE TABLE?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn