Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Sybase to Oracle : Trancount

349000Nov 20 2002 — edited Dec 23 2002
Hi,
BEGIN TRANSACTION in Sybase is handled by omwb_emulation package in Oracle. But the associated "RollBack Transaction" in Sybase is replaced to a ROLLBACK WORK in Oracle, which seems to be wrong. I feel that it should be "RollBack to somesavepoint" ?

Example:
################### SYBASE CODE #########################################

BEGIN TRANSACTION

SELECT @inscount = <somevalue>
SELECT @delcount = <somevalue>
IF @inscount = @delcount
BEGIN
DELETE xxx where <somecondition>;
SELECT @error_n = @@error
COMMIT TRANSACTION
END
ELSE
BEGIN
ROLLBACK TRANSACTION
END
END

################## ORACLE CODE BY OMWB ###############################
1 /* Emulating @@TRANCOUNT functionality in Oracle model */
2 BEGIN
3 OMWB_ARTIC.globalPkg.trancount:=OMWB_ARTIC.globalPkg.trancount+1;
4
5 PRC_ARCHIVE_KM_DATA.inscount := <some value>;
6 PRC_ARCHIVE_KM_DATA.delcount := <some value>;
7
8 IF PRC_ARCHIVE_KM_DATA.inscount = PRC_ARCHIVE_KM_DATA.delcount THEN
9 BEGIN
10 DELETE xxx
11 WHERE somecondition;
12
13 IF OMWB_ARTIC.globalPkg.trancount = 1 THEN
14 COMMIT WORK;
15 END IF;
16 IF OMWB_ARTIC.globalPkg.trancount > 0 THEN
17 OMWB_ARTIC.globalPkg.trancount:=OMWB_ARTIC.globalPkg.trancount-1;
18 END IF;
19
20 ELSE
21 BEGIN
22 OMWB_ARTIC.globalPkg.trancount:=0;
23 ROLLBACK WORK; <-----------------MY CONCERN is HERE
24 EXIT;
25 END;

#####################

I feel that a savepoint has to be defined at line 2 (like Savepoint abc), and the ROLLBACK WORK in line 23 has to change to ROLLBACK to abc.

Am I right ?

Please send it replies to vikram_n@infosys.com

Thanks and Regards,
Vikram



Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 20 2003
Added on Nov 20 2002
1 comment
682 views