Create user using a function

0

Someone could help me, she gets error when saving '-'

Error (19.5): PLS-00103: Encountered the symbol "CREATE" when expecting one of the following: (start case declare exit for goto if loop mod null pragma raise return select select update while with

asked by anonymous 25.05.2016 / 18:58

1 answer

1

Change to what is described below:

execute_immediate('CREATE USER USERN IDENTIFIED BY 12345678');
execute_immediate('GRANT CREATE SESSION TO USERN');
execute_immediate('GRANT RL_SADP_USUARIO TO USERN');
execute_immediate('GRANT RL_ACESSO_CONSULTA TO USERN');

I just can not remember if the ";" at the end of each run. It is also necessary for the logged in user to have the rights to create users.

Note: It may be better and safer than creating a user in the database, creating a user table with passwords and encryption, and letting the application authenticate if the focus is to enter users for use in systems. banking, these users can modify the bank without needing a system, which is potentially dangerous

    
03.08.2016 / 21:00