title: How to force exit a function from another one in PL/SQL ORACLE?
body: <p>Let's say I have a function that do a lot of work creating files and reports.
  I need an option to abort the execution and rollback changes by using a savepoint.</p>
  
  <p>What I still don't know, can I pass a value to the <code>Function1</code> from <code>Function2</code>, which can be used to EXIT <code>Function1</code>?</p>
  
  <p>Execuse me if I am mistaking something it's a maintenance work here for an application from 2008. I am not used to PL/SQL.</p>
  
  <p>Any suggestions or corrections are welcomed.
  The function looks like that already ( I removed critical info ) : </p>
  
  <pre><code>FUNCTION LAUNCH_BATCH(p_batch_code IN batch_details.batch_code%TYPE,
                        -- other parameters omitted
                       )
    RETURN PLS_INTEGER
  IS
    v_counter       PLS_INTEGER := 0.;
    Response        PLS_INTEGER;
    v_commande      VARCHAR2(1000);
    v_format_date   VARCHAR2(16);
    v_oracle_job_id NUMBER;
  
    BEGIN
  
      Response := GET_BATCH_DETAILS(p_batch_code);
  
      IF Response &lt;&gt; 0 THEN
        IF Response = -2 THEN
          p_error_batch := ERR_EXCEPTION_ORA;
        ELSE
          p_error_batch := ERR_BATCH_NOT_FOUND;
        END IF;
  
        RETURN (Response);
      END IF;
  
      UPDATE batch_details
         SET business_date = p_business_date,
       WHERE batch_code = v_batch_details_record.batch_code;
  
      COMMIT;
  
      dbms_job.SUBMIT(v_oracle_job_id,
                      v_batch_details_record.procedure_name_to_call
                      || '(''' || p_business_date
                      || ''','
                      || ''''
                      || v_batch_details_record.batch_code
                      || ''','
                      || ''''
                      || v_batch_details_record.bank_code || ''');');
      COMMIT;
  
      RETURN (0.);
  
      EXCEPTION WHEN OTHERS THEN
      RETURN (- 1.);
    END LAUNCH_BATCH;
  </code></pre>