I have a weird problem in using SAMPLE clause. Why does the First SQL does not work, while the second one works fine.
SELECT * FROM SYS.ALL_TABLES SAMPLE(10)
SELECT * FROM MIDAS.GERMPLASM SAMPLE(10)
I'm trying to SAMPLE
a SQL query not just a table, but I could not figure out how I should use the SAMPLE clause. Is there any other way besides sample clause? Note: I want to do this in a random manner; not the first N rows.
Update:
First of all, thank you for reading this Q to help. But I already know that this SQL does not work because the SAMPLE clause is using a hidden column, ROWID. What I don't know is how to do this if ROWID does not exist in the table.
Here is a reproducible example SQL that I try to SAMPLE randomly:
SELECT cols.table_name, cols.column_name, cols.position, cons.status, cons.owner, cons.constraint_type
FROM all_constraints cons, all_cons_columns cols
WHERE cons.constraint_name = cols.constraint_name
AND cons.owner = cols.owner
ORDER BY cols.table_name, cols.position
I want to get small random subset of data (from query), to compute statistical properties of table columns before fetching everything from DB.
Thank you
sys.all_all_tables
tosys.all_tables
- Patrick Bacon