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!