日期:2014-05-17  浏览次数:21351 次

select * from user_all_tables sample(10) 大家来看看
SQL code
select * from user_all_tables sample(10)  --这个不好用
--但是,可但是,但可是,可是
select * from user_all_tables         --这个好用
select * from test sample(10)         --这个好用




为什么呢???

select * from user_all_tables sample(10) 为什么不好用呢??

------解决方案--------------------
这个sample(10)是什么意思?好像还没见过这种写法。
------解决方案--------------------
看了下,这个返回一定百分比数据的语句不能用一些有聚合的视图中。
Error:
ORA-01446: cannot select ROWID from view with DISTINCT, GROUP BY, etc.

Cause:
You tried to create a view that included a ROWID in the SELECT statement as well as a clause such as DISTINCT or GROUP BY. This is not allowed.

Action:
The options to resolve this Oracle error are:

1. Since the DISTINCT or GROUP BY causes the records in the view to not correspond directly to the underlying physical records, the ROWID values can not be returned.

Either remove the DISTINCT or GROUP BY clause,

OR

Remove the ROWID column from the the SELECT statement.

------解决方案--------------------
道理很简单 user_all_tables 是视图 ,test是表
------解决方案--------------------
学习