ORACLE "desc table"对应的SQL语句


desc test

等同于


 SELECT OWNER,
         TABLE_NAME,
         COLUMN_NAME,
         DATA_TYPE
         || DECODE (
               DATA_TYPE,
               'NUMBER', DECODE (
                               '('
                            || NVL (TO_CHAR (DATA_PRECISION), '*')
                            || ','
                            || NVL (TO_CHAR (DATA_SCALE), '*')
                            || ')',
                            '(*,*)', NULL,
                            '(*,0)', '(38)',
                               '('
                            || NVL (TO_CHAR (DATA_PRECISION), '*')
                            || ','
                            || NVL (TO_CHAR (DATA_SCALE), '*')
                            || ')'),
               'FLOAT', '(' || DATA_PRECISION || ')',
               'DATE', NULL,
               'TIMESTAMP(6)', NULL,
               '(' || DATA_LENGTH || ')')
            AS DATA_TYPE,
         DATA_LENGTH,
         NULLABLE
    FROM DBA_TAB_COLUMNS
   WHERE OWNER IN ('OWNER')
         AND TABLE_NAME = UPPER ('table_name')
 ORDER BY OWNER, TABLE_NAME, COLUMN_ID;



你可能感兴趣的:(ORACLE "desc table"对应的SQL语句)