PL/SQL (MOSC)

MOSC Banner

ORA-06519: active autonomous transaction detected and rolled back

in PL/SQL (MOSC) 5 commentsAnswered

Hi,

I'm using Oracle 19c (19.17) and want grant a role to a user based on some criteria. If the criteria are met the role should be assigned.

I've created the following:

1) a role

CREATE ROLE POWERBI_DEV2 IDENTIFIED USING SYSTEM.ASSIGN_ROLE_POWERBI_F;

-- Object privileges granted to POWERBI_DEV2

GRANT SELECT ON SYS.dba_users TO POWERBI_DEV2;

2) a function

CREATE OR REPLACE function SYSTEM.Assign_role_powerbi_f 

--authid current_user

return number authid current_user

as

--pragma autonomous_transaction;


 HOSTNAME varchar2 (60);

 GEBR varchar2 (60);

 PROG varchar2 (60);

 v_sid number;

 v_serialnum number;


begin

 select upper(sys_context ('USERENV', 'SESSION_USER')) into GEBR from dual;

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center