Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Selecting n number of rows, randomnly from a table

user480947Sep 8 2008 — edited Sep 12 2008
I am having a problem where I have to select "n" number of rows randomnly inside a cursor where n is my percentage
I thought of using sample, which works well if I hard code the number.

insert into run_sample_birthmark sample(v_totaldispositionpct)
select birthmark from(select birthmark from run_depreciation_future
where owner = v_owner and eqp = v_eqp
and sampleindicator is null

But the problem is that I am not able to pass the variable(v_totaldispositionpct) in the sample as my procedure fails.

Any clues ?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 10 2008
Added on Sep 8 2008
12 comments
640 views