擷取
oracle
表和資料庫字段時,需要用到的表
select table_name from user_tables; //
目前使用者名下的表的資訊
select table_name from all_tables; //
目前使用者有權限的表的資訊
(隻要對某個表有任何權限,即可在此視圖中看到表的相關資訊)
select table_name from dba_tables; //
系統裡所有的表的資訊,需要
DBA
權
限才能查詢
注意:表名和使用者名,必須大寫
例如:
select owner,table_name from all_tables
where table_name = 'STUDENTS';
select * from user_tab_columns where Table_Name='
使用者表
';
select * from all_tab_columns where Table_Name='
使用者表
';
select * from dba_tab_columns where Table_Name='
使用者表
';
/* user_tab_columns
:
table_name,column_name,data_type,data_length,data_precision,data_scale,nulla
ble,column_id
等