Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Facing problem with "BEGIN NOT ATOMIC"

0 views
Skip to first unread message

Anupam

unread,
Sep 14, 2001, 9:40:50 PM9/14/01
to
Hi,

I have a stored procedure as follows:

CREATE PROCEDURE TEST_PROC2 ( )
LANGUAGE SQL
------------------------------------------------------------------------
-- SQL Stored Procedure
------------------------------------------------------------------------
P1: BEGIN NOT ATOMIC

INSERT INTO
TEST_TABLE
(
NAME,
NO
)
VALUES
(
'PROC TWO',
2
);

--COMMIT;
-- Simulate an error condition here.
SIGNAL SQLSTATE '75002' SET MESSAGE_TEXT = 'Error in Proc 2';
END P1

Now as I understand, the NOT ATOMIC clause in the BEGIN means that if
an error occurs within the compound statement, then the entire
compound is not rolled back. However, in this case, when the SIGNAL is
raised, the INSERT is being rolled back. The only way to commit the
INSERT before the SIGNAL is raised is to include the COMMIT statement.
IS this how NOT ATOMIC is supposed to work? I am getting confused
here.

Regards
Anupam

Gustavo Arocena

unread,
Sep 17, 2001, 11:57:19 AM9/17/01
to
Your understanding of BEGIN NOT ATMIC is correct. Maybe it's your
application (or the caller) the one that is rolling back the actions in the
procedure when it returns an sqlcode different from 00000.
-Gustavo
0 new messages