title: Call dbms_comparison Oracle package from function
body: <p>I am posting this question as I am facing some errors when trying to use the dbms_comparison oracle package from an Oracle function. </p>
  
  <p>I created a function which should return the scanID of the performed comparison to be able to retrieve the scanID's value from Java. However, the function is not being successfully executed as it is raising some errors. The dbms_comparison is being recognized as an identifier and therefore it is raising the following error: PLS-00201: identifier 'DBMS_COMPARISON' must be declared. </p>
  
  <p>Please find below the Oracle function I created. Any help would be appreciated.</p>
  
  <pre><code>    CREATE OR REPLACE FUNCTION compareRecords
      RETURN NUMBER IS
      scanID number;
      v_scan_info dbms_comparison.comparison_type;
      v_compare_result boolean;
      begin
           v_compare_result:= dbms_comparison.compare(
                           comparison_name =&gt; 'synchronised',
                           scan_info =&gt; v_scan_info,        
                           perform_row_dif =&gt; TRUE);
  
      dbms_output.put_line('Scan id: '||v_scan_info.scan_id);
      scanID := v_scan_info.scan_id;
  
      if v_compare_result = TRUE then
         dbms_output.put_line(a =&gt; 'Tables are synchronized!');
      else
         dbms_output.put_line(a =&gt; 'Warning! Data divergence found!'||chr(10));
      end if;
      RETURN scanID;
  end compareRecords;
  </code></pre>