DBAsupport.com Forums - Powered by vBulletin
Results 1 to 8 of 8

Thread: Forcing a Commit or Save

  1. #1
    Join Date
    May 2001
    Location
    Columbus OH
    Posts
    10

    Question

    In Forms, how can I programmatically force a commit or save of the current record? Thanks for any help you can give.

  2. #2
    Join Date
    Oct 2000
    Posts
    90
    I don't get exactly what you mean but if you want to make the record look like it has been changed, set a field to the value in the field, ie

    :block.field := :block.field;

    This wont change the value but would make forms think the record had changed.

  3. #3
    Join Date
    May 2001
    Location
    Columbus OH
    Posts
    10
    What I'm trying to do is put some PL/SQL code in forms to save the data to the database so the 'Would you like to save?' message does not come up.

    Example:

    if al_b = 'ALERT_BUTTON1' then
    --save or commit here.
    /*this is what I have now: */ COMMIT_FORM;
    end if;

    This if statement gives me an ORA-06502 error message. The alert message askes the user if they want to save the current record.

  4. #4
    Join Date
    May 2001
    Posts
    70
    You might want to look at the form or block level for any special handling for on_commit.

    Good Luck

  5. #5
    Join Date
    Oct 2000
    Posts
    90
    That's a bit clearer.

    The 6502 is a Numeric or value error, this is probably because you are trying to insert characters into a number or date field. There is obviously no way to force Oracle to allow this, so you will have to find out where the problem is.

    If you work this out and you want a silent commit (not popping up the default oracle message), set the system message level, so the code would look like

    :system.message_level := '25';
    commit;
    :system.message_level := 0;

    Hope this is of help


  6. #6
    Join Date
    May 2001
    Location
    Columbus OH
    Posts
    10
    I fixed it by doing this:

    if al_button = 88 then
    commit_form;
    end if;

    The 88 came from the value of al_button when I pressed the OK on the alert in debug mode. A little crude, but it works.

  7. #7
    Join Date
    Aug 2000
    Posts
    462
    If you recompile that code in a future version of Forms, there's no guarantee (and a likelihood against) it compiling and executing correctly. That 88 is a constant defined in the Forms product; that could be changed at any time. Try to make your code more generic and use system defined values whenever possible.

    FYI

    If you email me that form, I'll help you.
    Oracle DBA and Developer

  8. #8
    Join Date
    Aug 2000
    Posts
    462
    The reason you ended up using 88 is because you didn't really know what ALERT_BUTTON1 was. It is not a string value. It is a declared constant, thus the quotes are invalid. That's why you got the data type error. You were trying to compare the result of your alert button push to a string, when that value is numeric.

    From your earlier code:

    if al_b = 'ALERT_BUTTON1' then
    --save or commit here.
    /*this is what I have now: */ COMMIT_FORM;
    end if;

    How it should be:

    if al_b = ALERT_BUTTON1 then
    --save or commit here.
    /*this is what I have now: */ COMMIT_FORM;
    end if;

    Oracle DBA and Developer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width