dbTalk Databases Forums  

detecting error in pervasive stored procedure

comp.databases.btrieve comp.databases.btrieve


Discuss detecting error in pervasive stored procedure in the comp.databases.btrieve forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
mbosco51@hotmail.com
 
Posts: n/a

Default detecting error in pervasive stored procedure - 02-22-2005 , 03:01 PM






Hi. I have to convert some stored procedures from Microsoft SQL Server
2000 to Pervasive. One of the sp's does an insert into a table
followed by an insert into an audit table if the first insert is
successful. Here's some pseudo code...

BEGIN TRANSACTION
INSERT INTO TABLE1....
IF @@ERROR <> 0
ROLLBACK TRANSACTION
ELSE
INSERT INTO AUDIT TABLE...
IF @@ERROR <> 0
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
END IF
END IF

I got all the transactions statements converted, but cannot find the
Pervasive equivalent of @@ERROR. This contains the error status of the
most recent statement. 0 = success. I see something similar in
Pervasive called SQLSTATE, but I wasn't able to get it to work. If
anyone can help, it would be greatly appreciated.

Thanks!


Reply With Quote
  #2  
Old   
mbosco51@hotmail.com
 
Posts: n/a

Default Re: detecting error in pervasive stored procedure - 02-22-2005 , 03:49 PM






Never mind, I got the answer. I converted the line to...

IF (SQLSTATE <> '00000') then


mbosc... (AT) hotmail (DOT) com wrote:
Quote:
Hi. I have to convert some stored procedures from Microsoft SQL
Server
2000 to Pervasive. One of the sp's does an insert into a table
followed by an insert into an audit table if the first insert is
successful. Here's some pseudo code...

BEGIN TRANSACTION
INSERT INTO TABLE1....
IF @@ERROR <> 0
ROLLBACK TRANSACTION
ELSE
INSERT INTO AUDIT TABLE...
IF @@ERROR <> 0
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
END IF
END IF

I got all the transactions statements converted, but cannot find the
Pervasive equivalent of @@ERROR. This contains the error status of
the
most recent statement. 0 = success. I see something similar in
Pervasive called SQLSTATE, but I wasn't able to get it to work. If
anyone can help, it would be greatly appreciated.

Thanks!


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.