I want to create an array in sql with user ids, and create a loop which will pick user id from array. And create a user in sql db.
Please find the code below. It is not working as expected :
declare type namesarray IS VARARRAY (50) OF VARCHAR2 (10);
declare name namesarray;
declare total integer;
names = namesarray('resh1','resh2');
total = names.count;
while (i <= total)
begin
EXECUTE IMMEDIATE 'create user names(i) identified by newpass01;
dbms_output.put_line("created user 'names(i)");
end
dbms_output.put_line("cannot create user 'names(i)");