Home  >  Article  >  Database  >  Oracle通过字段类型查询字段

Oracle通过字段类型查询字段

WBOY
WBOYOriginal
2016-06-07 16:07:351079browse

有的时候我们需要在oracle中通过字段名、字段类型、字段长度、字段注释、表名来查询具体的字段信息。比如:昨天同事问我,咱们数

有的时候我们需要在Oracle中通过字段名、字段类型、字段长度、字段注释、表名来查询具体的字段信息。比如:昨天同事问我,,咱们数据库里面有用过blob类型的吗?我一时也想不起来具体哪个字段或那张表用了blob类型。于是就用如下语句查询库里面所有字段类型为blob。具体sql如下:

SELECT b.column_name column_name --字段名
      ,b.data_type data_type    --字段类型
      ,b.data_length            --字段长度
      ,a.comments comments      --字段注释
      ,A.table_name table_name    --表名
FROM user_col_comments a
    ,all_tab_columns b
WHERE a.table_name = b.table_name and
    b.data_type = 'BLOB'
    group by b.column_name,b.data_type,b.DATA_LENGTH,a.comments,
    a.table_name;

查询到的截图如下:

这里写图片描述

本文永久更新链接地址

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn