home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a524 / 37.ddi / demo / demo2.sql < prev    next >
Encoding:
Text File  |  1991-03-04  |  1.6 KB  |  52 lines

  1. rem
  2. rem $Header: demo2.sql,v 6.1 90/02/16 18:40:00 nsalah Exp $ demo2.sql Copyr (c) 1989 Oracle
  3. rem
  4. rem V6PLS10030,DISK$DEV2:[PLS1FREEZE.DEMO.10030]
  5. /*        SCRIPT: DEMO2                                          */
  6. /* Shows that you can get feedback on the execution of SQL statements. */
  7. /* In this procedure, we use SQL%ROWCOUNT to show that you can get     */
  8. /* information on how many rows were affected by the previous SQL      */
  9. /* statement.                                                          */
  10.  
  11. set termout off;
  12. START load_emp
  13. delete from temp;
  14. commit;
  15. set termout on;
  16.  
  17. set feedback 100
  18. prompt >>>>>  Here's a list of all salespeople and their commissions:
  19. prompt >>>>>  (Note: There are 5 people with a commission > $350)
  20. select ename, job, sal, comm from emp where job = 'SALESMAN'
  21. order by comm desc;
  22.  
  23. prompt >>>>>  The current total salary of all salespeople is:
  24. select sum(sal) from emp where job = 'SALESMAN';
  25.  
  26. prompt >>>>>  Hit return to load our PL/SQL procedure which gives a 10%
  27. prompt >>>>>  salary increase to salespeople with commissions > $350, but
  28. prompt >>>>>  only if there are three or fewer people who qualify...
  29. pause
  30.  
  31. GET demo2_pls
  32. .
  33.  
  34. prompt
  35. prompt >>>>>  Hit return to run this procedure, and then we'll look at the
  36. prompt >>>>>  TEMP table...
  37. pause
  38.  
  39. START demo2_pls
  40. /
  41. select col1, message from temp;
  42.  
  43. prompt >>>>>  Hit return to look at the salespeople again to make sure
  44. prompt >>>>>  their salaries have not been changed...
  45. pause
  46.  
  47. select ename, job, sal, comm from emp where job = 'SALESMAN'
  48. order by comm desc;
  49.  
  50. prompt >>>>>  The total salary of all salespeople is still:
  51. select sum(sal) from emp where job = 'SALESMAN';
  52.