Running Reports Synchronously vs Asynchronously in Oracle Forms

When working with Oracle Forms and Reports integration, one important decision is whether to run a report synchronously or asynchronously. This choice affects how the user experiences the report execution, the performance of the application, and how resources are managed on the server.

In this article, we will explain what synchronous and asynchronous report execution means in Oracle Forms, highlight their differences, provide practical examples, and guide you on when to use each mode effectively.


What Does Synchronous Execution Mean?

When a report is run synchronously, the form waits until the report is completely generated before continuing with other processing.

  • The report request is sent to the Reports Server.
  • The Form session pauses until the report finishes running.
  • After completion, the report output (PDF, HTML, Excel, etc.) is returned, and then control goes back to the Form.

Example

SET_REPORT_OBJECT_PROPERTY(repid, REPORT_COMM_MODE, SYNCHRONOUS);

In this case, if the report takes 20 seconds to complete, the form will remain idle for those 20 seconds, and the user cannot continue working until the report finishes.

Advantages of Synchronous Mode

  • Ensures the user receives the report immediately.
  • Simpler for cases where report output is required before the next step.
  • Useful when further processing depends on the report’s completion.

Disadvantages

  • Blocks the form until the report is done.
  • If the report takes longer, it may frustrate the user.
  • Not suitable for heavy or long-running reports.

What Does Asynchronous Execution Mean?

When a report is run asynchronously, the form does not wait for the report to complete.

  • The report request is sent to the Reports Server.
  • The Form session continues immediately, allowing the user to keep working.
  • The report runs in the background, and the user can later check or open it.

Example

SET_REPORT_OBJECT_PROPERTY(repid, REPORT_COMM_MODE, ASYNCHRONOUS);

Here, the report may take 20 seconds or more to generate, but the user can continue navigating the form without waiting.

Advantages of Asynchronous Mode

  • Improves user experience by allowing them to keep working.
  • Ideal for reports that take longer to process.
  • Reduces chances of the form session being locked or timing out.

Disadvantages

  • User may need to manually check when the report is ready.
  • If immediate report results are required, this approach adds extra steps.

Key Differences Between Synchronous and Asynchronous

FeatureSynchronous ExecutionAsynchronous Execution
User ExperienceUser must wait until report finishesUser can continue working immediately
Processing ControlForm session is blocked during reportForm session is free
Best ForQuick, small reportsLong-running, resource-heavy reports
ComplexityEasy to implement and manageRequires mechanism to check results
Response TimeImmediate once report finishesDelayed, user may need to retrieve

When to Use Each Mode

Use Synchronous Execution if:

  • The report is small and generates quickly.
  • The next steps in the form depend on the report output.
  • The report is critical for user decisions that must be made immediately.

Use Asynchronous Execution if:

  • The report is large and takes significant time to complete.
  • You want to avoid blocking the user from continuing work.
  • The report is optional or for reference, not an immediate requirement.

Example: Running a Report in Oracle Forms

Below is a sample code that highlights synchronous vs asynchronous modes:

DECLARE
   repid       REPORT_OBJECT;
   v_report_id VARCHAR2(100);
   v_url       VARCHAR2(2000);
BEGIN
   repid := FIND_REPORT_OBJECT('REP_SALES');

   -- Run report synchronously
   SET_REPORT_OBJECT_PROPERTY(repid, REPORT_COMM_MODE, SYNCHRONOUS);

   -- OR run asynchronously
   -- SET_REPORT_OBJECT_PROPERTY(repid, REPORT_COMM_MODE, ASYNCHRONOUS);

   SET_REPORT_OBJECT_PROPERTY(repid, REPORT_DESTYPE, CACHE);
   SET_REPORT_OBJECT_PROPERTY(repid, REPORT_DESFORMAT, 'PDF');
   SET_REPORT_OBJECT_PROPERTY(repid, REPORT_SERVER, 'rep_server1');

   v_report_id := RUN_REPORT_OBJECT(repid);

   v_url := 'http://myserver:7778/reports/rwservlet/getjobid' || 
            SUBSTR(v_report_id, LENGTH('REP_SERVER1')+2);

   WEB.SHOW_DOCUMENT(v_url, '_blank');
END;

In this code, changing just one property (REPORT_COMM_MODE) allows you to switch between synchronous and asynchronous execution.


Best Practices

  • For fast, frequent reports → use synchronous mode.
  • For heavy, analytical, or summary reports → use asynchronous mode.
  • Always inform the user about the mode chosen (e.g., show a message like “Your report is being generated in the background.”).
  • Monitor Reports Server load, as running many synchronous reports can slow down the system.
  • Combine asynchronous mode with notifications or status checks so users know when their report is ready.

Conclusion

Running reports in Oracle Forms can be done synchronously or asynchronously, and the choice depends on your business needs. Synchronous execution ensures immediate report delivery but blocks the user session, while asynchronous execution allows background processing and smoother user experience for long reports. By understanding the differences and applying best practices, you can optimize performance and usability in your Oracle Forms applications.

Vinish Kapoor
Vinish Kapoor

An Oracle ACE and software veteran with 25+ years of experience, passionate about AI and IT innovation.

guest

0 Comments
Oldest
Newest Most Voted