random selection [message #598994] |
Mon, 21 October 2013 05:14 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
|
i have a parameter form where user will input from item to item and items within this range will be come as output , but i want an option to select the random items from the list, like i may not select all the items from 1 to 10 , but instead i want to pick or select randomly , i may opt for 1,3,4 and 7.
|
|
|
Re: random selection [message #598996 is a reply to message #598994] |
Mon, 21 October 2013 05:20 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
John Watson
Messages: 8944 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
orclz> select * from emp sample(20);
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- ------------------- ---------- ---------- ----------
7521 WARD SALESMAN 7698 1981-02-22 00:00:00 1250 500 30
7698 BLAKE MANAGER 7839 1981-05-01 00:00:00 2850 30
orclz> select * from emp sample(20);
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- ------------------- ---------- ---------- ----------
7521 WARD SALESMAN 7698 1981-02-22 00:00:00 1250 500 30
7844 TURNER SALESMAN 7698 1981-09-08 00:00:00 1500 0 30
7876 ADAMS CLERK 7788 1987-05-23 00:00:00 1100 20
7902 FORD ANALYST 7566 1981-12-03 00:00:00 3000 20
orclz> select * from emp sample(20);
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- ------------------- ---------- ---------- ----------
7521 WARD SALESMAN 7698 1981-02-22 00:00:00 1250 500 30
7566 JONES MANAGER 7839 1981-04-02 00:00:00 2975 20
orclz>
|
|
|
|
Re: random selection [message #599000 is a reply to message #598999] |
Mon, 21 October 2013 05:37 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
John Watson
Messages: 8944 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
You don't seem to read your own questions, never mind my answer. You wanted random rows, and Ive demonstrated the syntax to do this. Now you are talking about BETWEEN. Perhaps someone else can make sense of this. I can't.
|
|
|
|