6 Replies Latest reply: Aug 5, 2011 1:17 PM by 878110 RSS

    Illegal Restricted Procedure workaround

      I am in a scenario where i need to execute a trigger on - 'ON-DISPATCH-EVENT' of an ActiveX control-

      The PL/SQL code to be executed contains keywords like next_record, commit , go_block

      On run time when the trigger is executed i get an error:
      FRM-40737 Illegal restricted procedure NEXT_RECORD in ON-DISPATCH_EVENT trigger

      I am using forms 6i
      Please suggest a workaround...
        • 1. Re: Illegal Restricted Procedure workaround
          sounds like you can just make it unrestricted.
          Very interesting! why can't we do this with every trigger. I see the restricted thing as the biggest problem with this product.

          Specifies the dispatch mode for ActiveX control events. By default, all PL/SQL event procedures that are associated with ActiveX events are restricted. This means that go_item cannot be called from within the procedure code and OUT parameters are not observed. However, there are instances when the same event may apply to multiple items and a go_item is necessary. This requires that the event be dispatched as unrestricted. Using the On-Dispatch-Event trigger, you can call DISPATCH_EVENT to specify the dispatch mode as either restricted or unrestricted. For more information about working with ActiveX control events, see Responding to ActiveX Control Events in the online help system.


          (sync NUMBER,

          Built-in Type unrestricted procedure
          Enter Query Mode yes


          sync     Specifies the dispatch mode as either restricted (RESTRICTED), or unrestricted (RESTRICTED_ALLOWED).
          • 2. Re: Illegal Restricted Procedure workaround
            I saw this into the manual before posting here.

            Please tell , Exactly what i need to do to run my code?

            before my code didn't work out
            • 3. Re: Illegal Restricted Procedure workaround
              The best solution to this limitation is to use a Timer to execute the Restricted Built-ins. In your case, you would create a 1 millisecond timer in your On-Dispatch-Event trigger at the point where you want to execute the Restricted built-in. Next you need to create Module/Form level When-Timer-Expired (WTE) trigger to handle the execution of your timer. For example:
              /* Sample On-Dispatch-Event trigger */
                 Timer_ID    TIMER;
                 /* Your trigger logic here... */
                 --Point in your logic where you want to call the Next_Record built-in
                 Timer_ID := Create_Timer('CALL_NEXT_RECORD',1,NO_REPEAT);
                 /* Rest of your logic here, so long as it is not dependent on the 
                    execution of the Next_Record built-in.  For this, you would need
                     to include this logic in the WTE trigger.  */
              /* Sample When-Timer-Expired trigger */
                 v_Timer   VARCHAR2(30) := Get_Application_Property(TIMER_NAME);
                 IF ( v_Timer := 'CALL_NEXT_RECORD' ) THEN 
                     /* Include any logic here that was dependend on the 
                        execution of the Next_Record built-in. */
                 END IF;
              Hope this helps,
              Craig B-)

              If someone's response is helpful or correct, please mark it accordingly.
              • 4. Re: Illegal Restricted Procedure workaround
                Thanks CraigB , i am greatful to you for your help,

                Can you suggest any other way to doing that, for i have 8 activeX objects to be placed on my canvasses,

                if i use the timer, all the code will be crowded at one single place that is the WTE trigger
                • 5. Re: Illegal Restricted Procedure workaround
                  There are other ways to accomplish your goal. The most reliable method I have found is the use of timers. Yes, this does place a lot of code in a single trigger, but you can always write Forms Program Units (PUs) for the different ActiveX objects and then call the program units from your WTE trigger moving the bulk of the code to the PUs. Either way, the controlling event is the WTE trigger.

                  • 6. Re: Illegal Restricted Procedure workaround
                    Thanks for your help CraigB