Basic PL/SQL anonymous code for listing all user in a DB..
declare
CURSOR cur
IS
select username from dba_users order by username;
cnt NUMBER;
rd cur%ROWTYPE;
BEGIN
OPEN cur;
LOOP
FETCH cur into rd;
EXIT WHEN cur%NOTFOUND;
DBMS_OUTPUT.put_line (rd.username);
END LOOP;
CLOSE cur;
END;
********************