Forum Stats

  • 3,750,457 Users
  • 2,250,181 Discussions
  • 7,866,986 Comments

Discussions

Bulk delete ApEx users

428025
428025 Member Posts: 247
edited Oct 21, 2008 7:10AM in APEX Discussions
Hi all

How can I delete ApEx users en-masse? These are Application Express users that I want to remove from a workspace. I have > 300 of them to remove and doing it one by one would take an age!

At the moment it looks easier to drop and re-create the workspace but that seems a bit drastic to me....

Thanks,
Steve
Tagged:

Answers

  • flavioc
    flavioc Member Posts: 1,122 Bronze Badge
    Hi,
    i suggest you to create a FOR LOOP cursor where you repeatedly call the following API procedure:

    APEX_UTIL.REMOVE_USER(
    p_user_id IN NUMBER,
    p_user_name IN VARCHAR2);

    If you execute it from within SQL Workshop, i guess you won't need to set the workgroup security id, if you are logged as workspace administrator.

    Bye,
    Flavio

    ----------------------------------------
    http://www.oraclequirks.com
  • 428025
    428025 Member Posts: 247
    Thanks for that, I wondered if I'd need to do it via PL/SQL or not... I'd hoped there was some UI page that I'd somehow missed and could delete multiple users that way.

    Thanks for the quick reply.

    Steve
  • 428025
    428025 Member Posts: 247
    FYI... this was the final script I run from SQL Workshop -> SQL Commands :
    begin
      for t in (select user_id
                  from wwv_flow_users
                 where user_name not in v('APP_USER'))
      loop
        apex_util.remove_user(p_user_id => t.user_id);
      end loop;
    end;
    It removed every user except me (the workspace admin). The 'in' list could of course be extended to exclude other users.....

    Steve
  • flavioc
    flavioc Member Posts: 1,122 Bronze Badge
    excellent Steve, so now you can flag your own answer as the right one ;-)

    Cheers,
    Flavio

    -----------------------------------
    http://www.oraclequirks.com
This discussion has been closed.