如何用sql語句求oracle 資料庫所有表的行數

時間 2021-10-14 22:24:01

1樓:匿名使用者

select table_name,num_rows from all_tables where tablespace_name='whs12lt' order by num_rows desc--檢視表空間為whs12lt中的所有表及各表行數,注意表空間一定要區分大小寫,我的當時用了小寫的whs12lt,結果顯示為0行。

這就是我執行後的結果(僅複製6、7、8這3行)6 t_exincome 804610

7 t_wfprestep 638695

8 t_extaxvou 606396

或者直接使用:select * from user_tables ,顯示使用者表的表外、表空間名、錶行數等很多內容。

2樓:匿名使用者

select table_name,num_rows from user_tables;

但不是最新的

在某些特定條件下才是最新的

使用stat的包來更新

或者analyze table 表名 compute statistics;

num_rows就是行數啊!

3樓:匿名使用者

可以從表user_tables中查詢。

select sum(num_rows) from user_tables ;

就是顯示使用者所有表的行數其中num_rows是每個表的行數,用sum加總一下,就是當前使用者所有表的總行數。

但因為user_tables中的資料不是實時統計,會有時間差,所以以上sql統計得到的結果與實際會存在一定誤差。

4樓:

不可能查到所有表的記錄,我讀了這麼多年計算機,都沒有聽過有這個功能呢....

如何檢視oracle資料庫中的所有表?

5樓:堇色

1、如果你想查資料庫中所有的表的話,可以查詢select * from dba_tables2、如果你想查詢資料庫中某個使用者下的表的話,也可以登入這個使用者,再查詢:

select * from user_tables3、要想匯入外部sql語句可以用命令

sql >@e:檔名.sql

如你想儲存 select * from tablename;語句的結果,可以在sql*plus 裡面這樣:

spool c:test.sql             //這是儲存檔案的位置

select * from tablename;

spool off

oracle資料庫中如何查詢乙個使用者a下面所有的表的資訊

6樓:匿名使用者

1、開啟pl/sql客戶端,登入oracle資料庫;

2、編寫sql,select * from user_tables t where table_name like 'test%' order by 1;即可檢視該使用者下所有的表;

3、編寫sql,select * from all_tables t;即可檢視該庫下所有使用者所有的表;

4、編寫sql;select * from user_tab_cols t where table_name like 'test%' order by 1, column_id;即可檢視該使用者下所有表的字段資訊;

7樓:

select * from all_tables u where u.owner='zhhy_user';-- zhhy_user是資料庫使用者

select * from all_tab_columns c where c.owner='zhhy_user';

使用該語句的前提是該使用者要具有查詢系統表的許可權。

8樓:匿名使用者

方法一:以a使用者登入資料庫,執行select table_name from user_tables;

方法二:以system使用者登入資料,執行select table_name from dba_tables where owner='a';

9樓:匿名使用者

select * from all_all_tables where owner = '你的使用者名稱(大寫)';

10樓:匿名使用者

查dba_tables或者all_tables檢視

dba_tab_statistics也可以

oracle中sql語句如何動態拼接

龍氏風采 sql code 在儲存過程裡面完成唄 例 create or replace procedure yyp cwdh table name varchar isstr sql varchar2 400 begin str sql select from table name where 1...

如何獲取oracle資料庫中sql語句的執行時間

rs s.executequery sql 到這一句,根本沒有fetch資料。整個時間應該是,到迴圈取完結果集為止。 杜爺1號 通過oracle執行計畫可以看到sql的執行時間。explain plan for select from table select from table dbms xpl...

sql語句oracle和mysql中可以執行,sqlserver中不行

select count from cos mobilenumber aorder bya.createdate desc 這句的order by再sql中沒意義 select count 只返回一行一列,沒必要進行進行排序可以直接寫成 select count from cos mobilenum...