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

  1. rem 
  2. rem $Header: sample1.sql,v 1002100.2 90/01/11 17:02:04 nsalah Exp $ sample1.sql Copyr (c) 1989 Oracle
  3. rem 
  4. rem V6PLS10021,DISK$DEV9:[PLS.DEMO.10021]
  5. /*
  6. ** This uses a simple FOR loop to insert 10 rows into a table.  
  7. ** The values inserted consists of two counter variables and one 
  8. ** of two possible character strings.  Which string is inserted
  9. ** is determined by whether the first counter variable is even
  10. ** or odd.
  11. **
  12. ** Copyright (c) 1989 by Oracle Corporation
  13. */
  14.  
  15. DECLARE
  16.     x NUMBER := 100;
  17. BEGIN
  18.     FOR i IN 1..10 LOOP
  19.     IF MOD(i,2) = 0 THEN     -- i is even
  20.         INSERT INTO temp VALUES (i, x, 'i is even');
  21.     ELSE
  22.         INSERT INTO temp VALUES (i, x, 'i is odd');
  23.     END IF;
  24.  
  25.     x := x + 100;        
  26.     END LOOP;
  27.     COMMIT;
  28. END;
  29. /
  30.