Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. /*13*/
  2. DECLARE
  3. v_countryid locations.country_id%TYPE := 'CA';
  4. v_loc_id locations.location_id%TYPE;
  5. v_counter NUMBER(2) :=1;
  6. v_new_city locations.city%TYPE := 'Montreal';
  7. BEGIN
  8. SELECT MAX(location_id) INTO v_loc_id FROM locations
  9. WHERE country_id=v_countryid;
  10. WHILE v_counter <= 3 loop
  11. INSERT INTO locations (location_id, city, country_id)
  12. VALUES ((v_loc_id + v_counter), v_new_city, v_countryid);
  13. v_counter := v_counter +1;
  14. END LOOP;
  15. COMMIT;
  16. END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement