title: Oracle scheduler error: Security Group ID (your workspace identity) is invalid
body: <p>I am trying to create oracle scheduler job (send mail) by pl/sql process (job is created on button click). It create job successfully but job always finish with error: </p>
  
  <blockquote>
    <p><strong>"ORA-20001: Security Group ID (your workspace identity) is invalid. ORA-06512: at "APEX_050100.WWV_FLOW_SECURITY", line 2939 ORA-06512: at
    "APEX_050100.HTMLDB_UTIL", line 3014 ORA-06512: at line 7 ORA-06512:
    at line 7</strong>.</p>
  </blockquote>
  
  <p>I also have tried to set security_group_id directly  (<code>apex_util.set_security_group_id(p_security_group_id =&gt; my_worspace_id</code> or 
    <code>wwv_flow_api.set_security_group_id(p_security_group_id=&gt;my_worspace_id</code>) but it always finish with the same error as my sample code. When i try to create job manually in sql developer it works. But when job is created by pl/sql process it finish with the mentioned error. Job is created successfully in both cases (pl/sql process or manually) with the same parameters so i do not understand why in case when job is created by pl/sql process it finish with error.  </p>
  
  <pre><code>    BEGIN
      DBMS_SCHEDULER.CREATE_JOB (
              job_name =&gt; '"INVERTORY"."TEST"',
              job_type =&gt; 'PLSQL_BLOCK',
              job_action =&gt; 'begin
  for c1 in (
     select workspace_id
       from apex_applications
      where application_id = 104 )
  loop
     apex_util.set_security_group_id(p_security_group_id =&gt;
  c1.workspace_id);
  end loop;
  
  HTMLDB_MAIL.SEND(
                 p_to =&gt;  ''****.****@****.com'',
                 p_from =&gt; ''noreply@****.com'',
                 p_subj =&gt;  ''test mail'',
                 p_body =&gt; ''komu'');
  
              end;',
              number_of_arguments =&gt; 0,
              start_date =&gt; TO_TIMESTAMP_TZ('2017-08-28 10:29:57.000000000 EUROPE/PRAGUE','YYYY-MM-DD HH24:MI:SS.FF TZR'),
              repeat_interval =&gt; NULL,
              end_date =&gt; NULL,
              enabled =&gt; TRUE,
              auto_drop =&gt; FALSE,
              comments =&gt; '');
  
      DBMS_SCHEDULER.SET_ATTRIBUTE( 
               name =&gt; '"INVERTORY"."TEST"', 
               attribute =&gt; 'logging_level', value =&gt; DBMS_SCHEDULER.LOGGING_OFF);
  
      DBMS_SCHEDULER.enable(
               name =&gt; '"INVERTORY"."TEST"');
  END;
  </code></pre>