Re: SQLFORMS3 PROBLEM

From: Steven P. Muench <smuench_at_oracle.com>
Date: Wed, 14 Apr 1993 10:40:20 GMT
Message-ID: <SMUENCH.93Apr14024020_at_hqsun4.oracle.com>


SIMON -- The reading given by the built-in function Form_Success

         effectively tells you whether the most recently executed
         built-in routine succeeded or not. You're correct that
         performing operations in an ON-MESSAGE, ON-ERROR (or
         PRE-BLOCK, PRE-RECORD, or PRE-FIELD for that matter) can give
         a success reading back to the Form_Success function when
         you'd wish it would refer to the success of the commit in
         this case.

         Here are a few tips:

              (1) You might be able to decide whether you are running
                  in post-only mode simply by knowing that the current
                  for has been called by another. If this is the case,
                  then checking the Application_Characteristic()
                  function to get the CALLING_FORM information will
                  let you decide whether to COMMIT_FORM or POST.

              (2) Use the fact that the :System.Form_Status must be
                  equal to 'QUERY' after a successful commit or post.
                  A commit will only be required when
                  :System.Form_Status equals 'CHANGED'. So, use the
                  following code:

                  DECLARE

--
-- Save the current message level for later
--
old_msg_lvl VARCHAR2(2) := :System.Message_Level; BEGIN
--
-- Set Message Level to suppress commit warning
--
:System.Message_Level := '15';
--
-- Try to Commit first
--
Commit_Form;
--
-- Leave the Message Level as before
--
:System.Message_Level := old_msg_lvl;
--
-- Check if the Commit failed
--
If :System.Form_Status <> 'QUERY' Then -- -- If commit (silently!) failed, try to post -- Post; -- -- If the post failed, then we have a problem -- If :System.Form_Status <> 'QUERY' Then Message('Unable to save changes...'); Raise Form_Trigger_Failure; End If; End If; END; Hope this helps... _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Steve Muench Email: smuench_at_oracle.com
  Forms Development
  Product Manager
                       A tourist doesn't know where he's been...
                       A traveller doesn't know where he's going.

                       Paul Theroux, 1992
Received on Wed Apr 14 1993 - 12:40:20 CEST

Original text of this message