Tech Rocks

Coldfusion
Java
JQuery

An online resource for latest web technologies like Coldfusion, JRun, Pro*C, JQuery, HTML5, PHP, W3C, Java, J2EE, C, C++, ORACLE, PL/SQL, MySql, Ajax, Coldbox, Fusebox, UNIX, JavaScript, NodeJS and much more...

Sunday, February 22, 2009

Using the SAVEPOINT Statement

http://www.csee.umbc.edu/help/oracle8/server.815/a68022/trans.htm#388

http://www.oracle.com.cn/other/9ionlinedoc/appdev.920/a97269/toc.htm

EXEC SQL SAVEPOINT start_delete1;

EXEC SQL DELETE FROM mail_list
WHERE stat = 'INACTIVES';
if (sqlca.sqlerrd[2] < 25) /* check number of rows deleted */
printf("Number of rows deleted is %d\n", sqlca.sqlerrd[2]);
else
{
printf("Undoing deletion %d rows\n", sqlca.sqlerrd[2]);
EXEC SQL WHENEVER SQLERROR GOTO sql_error;
EXEC SQL ROLLBACK TO SAVEPOINT start_delete1;
}

EXEC SQL WHENEVER SQLERROR CONTINUE;
EXEC SQL COMMIT WORK RELEASE;

0 comments :

Post a Comment