Link to home
Start Free TrialLog in
Avatar of okhari
okhari

asked on

FRM-40501: ORACLE error: unable to reserve for update or delete

I am facing a problem in oracle forms ver 4.5.
I am getting a FRM-40501: ORACLE error: unable to reserve record for update or delete error in the below code. Actually this is really a strange problem i am encountering, i am running this form thru two different
profiles with same oracle login id. when i am running in my profile it works fine. when i am
running in some other profile it come up with the FRM 40501 error.

If it is an envronment problem can you let me know the reasons.

This error occurs immediately after the values are assigned to the base table columns
B_price_susp_head.create_date  and  B_price_susp_head.create_id. See the code below.

once the ok button is pressed in the error message it saves the record in the database
when the commit_form is encountered.

I don't think this is a locking problem.. because it ultimately saves the record in the database.

Help in this regard will be highly appreciated.

Thanks in advance.

Code:

DECLARE
   QUICKEXIT     EXCEPTION;
   L_dummy       VARCHAR2(1);
   L_vdate       PERIOD.VDATE%TYPE := GET_VDATE;
   L_user_name   VARCHAR2(30) := Get_Application_Property(USERNAME);
   L_system_ind         SKULIST_DETAIL.SYSTEM_IND%TYPE;


   cursor C_CHECK_RECS is
      select 'x'
        from price_event_zone
       where price_change = :B_price_susp_head.price_change;

   cursor C_COUNT is
      select count(sku)
        from price_susp_detail
       where price_change = :B_price_susp_head.price_change;
BEGIN
   Issue_Savepoint('B');
   Set_Application_Property (CURSOR_STYLE, 'BUSY');
   if :PARAMETER.PM_mode <> 'VIEW' then
      P_VALIDATE;
      ---
      if :B_price_susp_head.zone_group_id is not NULL then  
         open C_CHECK_RECS;
         fetch C_CHECK_RECS into L_dummy;
         if C_CHECK_RECS%NOTFOUND then
            Set_Application_Property (CURSOR_STYLE, 'DEFAULT');
            emessage('MUST_ENTER_LOCS');
            Go_Item('B_action.PB_store');
            raise FORM_TRIGGER_FAILURE;
         end if;
      end if;
      if :PARAMETER.PM_MODE = 'NEW' then
         :B_price_susp_head.create_date := L_vdate;
         :B_price_susp_head.create_id   := L_user_name;          
      end if;
      ---
      Commit_Form;
      if :system.form_status not in ('QUERY','NEW') then
         Set_Application_Property (CURSOR_STYLE, 'DEFAULT');
         emessage('COMMIT_FAILURE');
         raise FORM_TRIGGER_FAILURE;
      end if;
   end if;

   Go_Item('B_action.PB_ok');

   open C_COUNT;
   fetch C_COUNT into :PARAMETER.PM_count;
   close C_COUNT;      
   Set_Application_Property (CURSOR_STYLE, 'DEFAULT');

   P_PASS_PARM_PCSKU;

EXCEPTION
   when QUICKEXIT then
      Set_Application_Property (CURSOR_STYLE, 'DEFAULT');
      NULL;
   when FORM_TRIGGER_FAILURE then
      Issue_Rollback('B');
      Set_Application_Property (CURSOR_STYLE, 'DEFAULT');
      raise;
   when OTHERS then
      Set_Application_Property (CURSOR_STYLE, 'DEFAULT');
      emessage(SQLERRM);
      raise FORM_TRIGGER_FAILURE;
END;
ASKER CERTIFIED SOLUTION
Avatar of twalgrave
twalgrave

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CleanupPing
CleanupPing

okhari:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.