Oracle Export Table Structure script

Source: Internet
Author: User

Select   Case  whenR= 1  Then(SelectS.comments fromUser_tab_comments swheretable_name=Aa.table_name)Else "' End  astable_comments, Case  whenR= 1  ThenAa.table_nameElse "' End  astable_name, AA.R ascolumn_sequence, aa. COLUMN_NAME, AA. Data_type, Aa.data_length, (Select 'Y' fromuser_cons_columns cu, user_constraints auwhereCu.constraint_name=Au.constraint_name andAu.constraint_type= 'P'    andAu.table_name=Aa.table_name andCu. column_name=Aa. COLUMN_NAME) asis_pk, aa. NULLABLE, AA. Data_default, Aa.column_comments from(SelectRow_number () Over(Partition byT.object_name Order  byT.object_name) R, T.object_name  astable_name, C.column_name, C.data_type, Case  whenC.nullable= 'N'  Then 'Not NULL' Else "' End  asNULLABLE, Case  whenC.data_typeinch('NVARCHAR2','CHAR','VARCHAR2') ThenTo_char (c.char_length) whenC.data_typeinch('LONG','FLOAT','CLOB','BLOB','DATE') Then ' '              whenC.data_type= ' Number'  Then                 Case  whenC.data_precision is NULL  andC.data_scale= 0  Then                 'INTEGER'                 Else                 RTrim(c.data_precision||','||C.data_scale,',')                 End             Else ' ' End  asData_length, Cc.comments ascolumn_comments, C.data_default fromuser_objects T, user_tab_columns C, user_col_comments ccwhereT.object_type= 'TABLE'    andC.table_name=T.object_name   andCc. table_name=C.table_name andCc. column_name=c.column_name) AA;

Oracle Export Table Structure script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.