Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Savepoints, Rollbacks in forms

Posted on 1999-01-14
2
Medium Priority
?
1,807 Views
Last Modified: 2008-02-20
I issue an insert into statement and before comitting I issue a clear_block(no_validate) to cancel the transaction, but the insert statement is not rolled back.  When I issue a rollback the command will delete my headings(title, datetime, userid etc.) off of the form.  I have tried using a savepoint that I set just after I set up my headings on the form and isssue the rollback to savepoint, but it still does not seem to work.  Can I rollback my insert into statement without clearing out my complete form?
0
Comment
Question by:murphydp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 35

Expert Comment

by:Mark Geerlings
ID: 1083672
A "clear_block" will only undo uncommitted inserts, updates or deletes in the current block.  It will not rollback any other statements that the form may have done since the last commit.

I usually save the userid and current date in global variables (Forms4.5 or earlier) or in a client-side package (Forms5.0 or later) and reset them in the form in the when-clear-form trigger.  That technique will not prevent the problem you are having, but it may give you a work around.
0
 

Accepted Solution

by:
jsanand earned 100 total points
ID: 1083673
Dear Murphydp,

You are right !!! The userid and other fields are changed to null when you issue a rollback command in forms. This is because forms internally issues a clear form for this.

To solve you problem you should use the form built in's

ISSUE_SAVEPOINT(<savepoint_name>);
ISSUE_ROLLBACK(<savepoint_name>);

Before entering the block mark a save point and issue a rollback when requires using the form builtin

Another work around to you problem is !!
based on certain condition the ON_INSERT trigger should fail
eg
  ON_INSERT trigger
 
  Begin
    If EVERYTHING_OK then
       INSERT_RECORD;
    Else
       NULL;
  End;

This way the record will not be inserted into the database and you even do not need to issue a rollback command

Hope this will solve your problems
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows how to recover a database from a user managed backup

664 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question