Advertisement
Guest User

Untitled

a guest
Jan 29th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. CREATE USER "Kyle" PROFILE "DEFAULT" IDENTIFIED BY "password" ACCOUNT UNLOCK
  2. WHERE NOT IN //Also tried 'WHERE NOT EXISTS'
  3. (
  4. SELECT username FROM all_users WHERE username = 'Kyle'
  5. )
  6.  
  7. IF NOT EXISTS
  8. (SELECT name FROM master.sys.server_principals
  9. WHERE name = 'Kyle')
  10. BEGIN
  11. CREATE LOGIN Kyle WITH PASSWORD = 'temppassword' MUST_CHANGE, CHECK_EXPIRATION=ON, CHECK_POLICY=ON
  12. END
  13.  
  14. declare
  15. userexist integer;
  16. begin
  17. select count(*) into userexist from dba_users where username='SMITH';
  18. if (userexist = 0) then
  19. execute immediate 'create user smith identified by smith';
  20. end if;
  21. end;
  22. /
  23.  
  24. SELECT count(*) INTO v_count_user
  25. FROM all_users
  26. WHERE username = 'Kyle'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement