home *** CD-ROM | disk | FTP | other *** search
- rem
- rem $Header: demo2.sql,v 6.1 90/02/16 18:40:00 nsalah Exp $ demo2.sql Copyr (c) 1989 Oracle
- rem
- rem V6PLS10030,DISK$DEV2:[PLS1FREEZE.DEMO.10030]
- /* SCRIPT: DEMO2 */
- /* Shows that you can get feedback on the execution of SQL statements. */
- /* In this procedure, we use SQL%ROWCOUNT to show that you can get */
- /* information on how many rows were affected by the previous SQL */
- /* statement. */
-
- set termout off;
- START load_emp
- delete from temp;
- commit;
- set termout on;
-
- set feedback 100
- prompt >>>>> Here's a list of all salespeople and their commissions:
- prompt >>>>> (Note: There are 5 people with a commission > $350)
- select ename, job, sal, comm from emp where job = 'SALESMAN'
- order by comm desc;
-
- prompt >>>>> The current total salary of all salespeople is:
- select sum(sal) from emp where job = 'SALESMAN';
-
- prompt >>>>> Hit return to load our PL/SQL procedure which gives a 10%
- prompt >>>>> salary increase to salespeople with commissions > $350, but
- prompt >>>>> only if there are three or fewer people who qualify...
- pause
-
- GET demo2_pls
- .
-
- prompt
- prompt >>>>> Hit return to run this procedure, and then we'll look at the
- prompt >>>>> TEMP table...
- pause
-
- START demo2_pls
- /
- select col1, message from temp;
-
- prompt >>>>> Hit return to look at the salespeople again to make sure
- prompt >>>>> their salaries have not been changed...
- pause
-
- select ename, job, sal, comm from emp where job = 'SALESMAN'
- order by comm desc;
-
- prompt >>>>> The total salary of all salespeople is still:
- select sum(sal) from emp where job = 'SALESMAN';
-