oracle如何查詢表中所有字段
oracle查詢表中所有字段
查詢表中所有字段
-- user_tab_columns 自定義的字段 SELECT column_name FROM user_tab_columns where table_name = upper('表名')? -- user_tab_cols 包含oracle創(chuàng)建的隱藏字段 SELECT column_name FROM user_tab_cols where table_name = upper('表名')?
將表所有列名查出,并拼成字符串
select Listagg(column_name, ',') WITHIN GROUP(ORDER BY column_name) from user_tab_columns? where table_name = upper('表名')? --不想查詢的字段名 and column_name not in ('字段名','字段名');
oracle查看所有表信息和字段信息以及注釋信息等
1、獲取表
select table_name from user_tables; //當(dāng)前用戶擁有的表 select table_name from all_tables; //所有用戶的表 select table_name from dba_tables; //包括系統(tǒng)表 select table_name from dba_tables where owner='用戶名' ALL_OBJECTS describes all objects accessible to the current user. 描述當(dāng)前用戶有訪問權(quán)限的所有對象 DBA_OBJECTS describes all objects in the database. 描述了數(shù)據(jù)庫中的所有對象 USER_OBJECTS describes all objects owned by the current user. 描述了當(dāng)前用戶所擁有的所有對象
- user_tables: TABLE_NAME,TABLESPACE_NAME,LAST_ANALYZED等
- dba_tables: ower,table_name,tablespace_name,last_analyzed等
- all_tables: ower,table_name,tablespace_name,last_analyzed等
- all_objects: ower,object_name,subobject_name,object_id,created,last_ddl_time,timestamp,status等
2、獲取表字段
user_tab_comments;表注釋 select * from user_tab_comments user_tab_comments:table_name,table_type,comments
相應(yīng)的還有dba_tab_comments,all_tab_comments,這兩個比user_tab_comments多了ower列。
3、獲取表注釋
user_tab_comments;表注釋 select * from user_tab_comments user_tab_comments:table_name,table_type,comments
相應(yīng)的還有dba_tab_comments,all_tab_comments,這兩個比user_tab_comments多了ower列。
4、獲取字段注釋
select * from user_col_comments user_col_comments:table_name,column_name,comments
相應(yīng)的還有dba_col_comments,all_col_comments,這兩個比user_col_comments多了ower列。
- user_col_comments;表字段注釋(列注釋)
- USER_COL_COMMENTS 視圖顯示已經(jīng)為表中的列輸入的注釋。
這些注釋通過comment命令添加到數(shù)據(jù)庫中。
USER_COL_COMMENTS 視圖包含3 列:
- Table_Name 表名或視圖名
- Column_Name 列名
- Comments 已經(jīng)為該列輸入的注釋
5、查表字段注釋事例
查看JH表中字段的注釋:
select table_name,column_name,comments from user_col_comments where table_name=‘JH';
總結(jié)
以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
Oracle故障處理Rman-06207&Rman-06214的方法
新搭建的環(huán)境,還沒上線,今天在部署腳本,RMAN 備份中有一個警告,下面這篇文章主要給大家介紹了關(guān)于Oracle故障處理Rman-06207&Rman-06214的相關(guān)資料,需要的朋友可以參考下2022-11-11Oracle單行函數(shù)(字符,數(shù)值,日期,轉(zhuǎn)換)
這篇文章主要介紹了Oracle單行函數(shù)(字符,數(shù)值,日期,轉(zhuǎn)換),本文結(jié)合實例代碼給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2023-07-07Oracle 數(shù)據(jù)庫特殊查詢總結(jié)
這篇文章主要介紹了Oracle 數(shù)據(jù)庫特殊查詢總結(jié)的相關(guān)資料,非常不錯,具有參考借鑒價值,需要的朋友可以參考下2016-08-08oracle數(shù)據(jù)庫關(guān)于索引建立及使用的詳細介紹
這篇文章主要介紹了oracle數(shù)據(jù)庫關(guān)于索引建立及使用,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-07-07Oracle 管道 解決Exp/Imp大量數(shù)據(jù)處理問題
Oracle的exp/imp是許多用戶經(jīng)常使用的兩個工具. 它們常被用來做數(shù)據(jù)庫的邏輯備份,數(shù)據(jù)庫重組和數(shù)據(jù)轉(zhuǎn)移等工作.2009-07-07如何查看oracle ojdbc所支持的JDBC驅(qū)動版本
本文介紹了如何查看Oracle JDBC驅(qū)動版本的方法,并指出ojdbc11.jar支持到JDBC 4.3版本,同時,也提醒了本地JDK版本與ojdbc11.jar兼容性的重要性2024-11-11