2026-03-12 20:23:15
This commit is contained in:
26
my/random_data/STORE_random_02.sql
Normal file
26
my/random_data/STORE_random_02.sql
Normal file
@@ -0,0 +1,26 @@
|
||||
declare
|
||||
max_id_client NUMBER;
|
||||
max_id_street NUMBER;
|
||||
i NUMBER;
|
||||
rand1 NUMBER;
|
||||
rand2 NUMBER;
|
||||
random_address VARCHAR2(50);
|
||||
random_street VARCHAR2(40);
|
||||
|
||||
begin
|
||||
select max(id) into max_id_client from CLIENT;
|
||||
select max(id) into max_id_street from US_STREET;
|
||||
|
||||
for i in 1..max_id_client loop
|
||||
rand1:=round(dbms_random.value(1,max_id_street));
|
||||
rand2:=round(dbms_random.value(1,400));
|
||||
|
||||
select FULLNAME into random_street from US_STREET where ID=rand1;
|
||||
random_address:=to_char(rand2)||' '||random_street;
|
||||
|
||||
update CLIENT set ADDRESS=random_address where ID=i;
|
||||
end loop;
|
||||
commit;
|
||||
end;
|
||||
/
|
||||
|
||||
Reference in New Issue
Block a user