home *** CD-ROM | disk | FTP | other *** search
/ Winzipper / Winzipper_ISO.iso / programming / oracle7 7.2 / DB / UTIL72 / SAMPLE1.SQL < prev    next >
Encoding:
Text File  |  1995-05-18  |  1.0 KB  |  39 lines

  1. rem 
  2. rem $Header: sample1.sql 7020100.1 94/09/28 16:39:49 cli Generic<base> $ 
  3. rem 
  4. Rem  Copyright (c) 1991 by Oracle Corporation 
  5. Rem    NAME
  6. Rem      sample1.sql - <one-line expansion of the name>
  7. Rem    DESCRIPTION
  8. Rem      <short description of component this file declares/defines>
  9. Rem    RETURNS
  10. Rem 
  11. Rem    NOTES
  12. Rem      <other useful comments, qualifications, etc.>
  13. Rem    MODIFIED   (MM/DD/YY)
  14. Rem     rvasired   05/12/92 -  Creation 
  15. /*
  16. ** This block uses a simple FOR loop to insert 10 rows into a table.  
  17. ** The values of a loop index, counter variable, and either of two 
  18. ** character strings are inserted.  Which string is inserted
  19. ** depends on the value of the loop index.
  20. **
  21. ** Copyright (c) 1989,1992 by Oracle Corporation
  22. */
  23.  
  24. DECLARE
  25.     x  NUMBER := 100;
  26. BEGIN
  27.     FOR i IN 1..10 LOOP
  28.     IF MOD(i,2) = 0 THEN     -- i is even
  29.         INSERT INTO temp VALUES (i, x, 'i is even');
  30.     ELSE
  31.         INSERT INTO temp VALUES (i, x, 'i is odd');
  32.     END IF;
  33.  
  34.     x := x + 100;        
  35.     END LOOP;
  36.     COMMIT;
  37. END;
  38. /
  39.