Oracle用SQL语句实现desc函数功能
2012-05-18 07:51:02 来源:WEB开发网核心提示:SELECT A.COLUMN_NAME 字段名, DATA_TYPE ||DECODE(DATA_TYPE,'DATE','','CLOB','','BLOB','','BFILE','
SELECT A.COLUMN_NAME 字段名, DATA_TYPE ||DECODE(DATA_TYPE,'DATE','','CLOB','','BLOB','','BFILE','','FLOAT','','LONG RAW','','LONG','','RAW','(' || TO_CHAR(DATA_LENGTH) || ')', (DECODE(SIGN(INSTR(DATA_TYPE, 'CHAR')),1, '(' || TO_CHAR(DATA_LENGTH) || ')',(DECODE(SUBSTR(DATA_TYPE, 1, 9), 'TIMESTAMP', '', (DECODE(NVL(DATA_PRECISION, -1), -1, '',(DECODE(NVL(DATA_SCALE, 0), 0, '(' || TO_CHAR(DATA_PRECISION) || ')', '(' || TO_CHAR(DATA_PRECISION) || ',' || TO_CHAR(DATA_SCALE) || ')'))))))))) 字段类型, A.NULLABLE 允许为空, A.DATA_DEFAULT 默认值, B.COMMENTS 字段注释 FROM ALL_TAB_COLUMNS A, ALL_COL_COMMENTS B WHERE B.TABLE_NAME=A.TABLE_NAME AND A.OWNER=B.OWNER AND A.COLUMN_NAME=B.COLUMN_NAME AND A.TABLE_NAME =UPPER( 'TABLE_NAME') AND A.OWNER =UPPER( 'USER') ORDER BY COLUMN_ID;
- ››oracle 恢复误删除的表和误更新的表
- ››SQL Server 2008 R2 下如何清理数据库日志文件
- ››Oracle分页查询排序数据重复问题
- ››Oracle创建dblink报错:ORA-01017、ORA-02063解决
- ››Oracle 提高SQL执行效率的方法
- ››Oracle 动态查询,EXECUTE IMMEDIATE select into...
- ››sqlite 存取中文的解决方法
- ››SQL2005、2008、2000 清空删除日志
- ››SQL Server 2005和SQL Server 2000数据的相互导入...
- ››sql server 2008 在安装了活动目录以后无法启动服...
- ››Oracle 11g必须开启的服务及服务详细介绍
- ››oracle性能34条优化技巧
更多精彩
赞助商链接