Skip to content

Instantly share code, notes, and snippets.

@OsBlaineOra
Created July 26, 2016 20:40
Show Gist options
  • Save OsBlaineOra/52a0b617be4d7525c2b8a2393d1f091d to your computer and use it in GitHub Desktop.
Save OsBlaineOra/52a0b617be4d7525c2b8a2393d1f091d to your computer and use it in GitHub Desktop.
set serveroutput on
update dd_members
set location = null
where location is not null;
delete from dd_locations
where location_name = 'dino-island';
commit;
declare
v_dino_island sdo_geometry;
type t_member_location is record (member_id dd_members.member_id%type,
new_location sdo_geometry);
type t_member_ids is table of t_member_location
index by pls_integer;
l_member_ids t_member_ids;
begin
v_dino_island := dd.generate_polygon_rad(100000, 50, p_lat => 26.846786, p_lon => -69.322920);
insert into dd_locations (location_name,
geometry)
values ('dino-island', v_dino_island);
select member_id,
generate_random_location(v_dino_island)
bulk collect into l_member_ids
from dd_members
fetch next 1000 rows only;
forall indx in 1 .. l_member_ids.count
update dd_members_t
set location = l_member_ids (indx).new_location
where member_id = l_member_ids (indx).member_id;
dbms_output.put_line(sql%rowcount);
commit;
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment