What do I do when the DDL statements are incomplete in the table structure?
The existing DDL statements include those for querying indexes and constraints. You can execute the DBMS_METADATA.get_ddl or show create table statements to query the DDL statements.
Here are some examples:
-- DDL statement for querying table indexes
SELECT dbms_metadata.get_ddl('INDEX', 'indexname', 'username') from dual;
-- SQL statement for querying table comments
SELECT 'comment on table ' || 'table_name' || ' is ' || '''' || comments || ''';'
FROM all_tab_comments where owner='USER1' AND table_name='T_1' ;
-- Add a table comment
comment on table T_1 is 'desc 2';
-- SQL statement for querying column comments
SELECT 'comment on column ' || 'table_name' || '.' || 'column_name' || ' is ' || '''' || comments || ''';'
FROM all_col_comments where owner='USER1' AND table_name='T_1' ;
-- Add a column comment
comment on column T_1.ID is 'ID 3';
Why are the displayed statements truncated when I check the DDL statements of a view or table on the view or table management page?
This is because that the DDL tab of the database object management page calls the content of the text field in the all_views table. In versions earlier than OceanBase Database V2.2.70, if the content of the text field in the all_views table is too long, it will be truncated.
Method 1: Upgrade OceanBase Database to V2.2.70 or later. This issue has been solved in OceanBase Database V2.2.70 and later versions.
Method 2: Run the
SHOW CREATE VIEW/TABLEstatement to directly query the complete structure statements of the target view or table.