Home » SQL & PL/SQL » SQL & PL/SQL » How to display records by sets of 3 interval (total 15)
How to display records by sets of 3 interval (total 15) [message #211434] Thu, 28 December 2006 11:47 Go to next message
oraclenub2006
Messages: 56
Registered: December 2006
Location: new york
Member
I have the following qry: takes input from user and return 15 records but 3 rec at a time.


See attachment..,

Thanks
Re: How to display records by sets of 3 interval (total 15) [message #211439 is a reply to message #211434] Thu, 28 December 2006 12:24 Go to previous messageGo to next message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
for a simple solution (in sqlplus), you can play around with pagesize and pause.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.6.0 - Production

SQL> set pagesize 6
SQL> set linesize 100
SQL> set pause on
SQL> prompt "Hit enter to get 3 records"
"Hit enter to get 3 records"
SQL> select * from emp;


     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7839 KING       PRESIDENT            17-NOV-81       5000                    10
      7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
      7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10


     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
      7566 JONES      MANAGER         7839 02-APR-81       2975                    20
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30

...
Re: How to display records by sets of 3 interval (total 15) [message #211442 is a reply to message #211439] Thu, 28 December 2006 13:13 Go to previous message
oraclenub2006
Messages: 56
Registered: December 2006
Location: new york
Member
Hi,
1. It would be too easy. The catch is initially the rec_cnt will be initialied to 3 hence the 1st 3 records, and iterate 5x until usr get to 15 records max and then exit.In order words, each transaction(different acct-num) allows 15 replies. A loop must be involved.
2. the interaction is via phone; a totally different animal.

But Thanks anyway Andrew.
Previous Topic: need help on query
Next Topic: Create Materialized View in Oracle 9.2.0.5
Goto Forum:
  


Current Time: Sat Dec 03 13:45:57 CST 2016

Total time taken to generate the page: 0.08432 seconds