I'm working on transfering sps from MS SQL to SAP DB. Is there a way to do something like this exapmple in SAP DB?
 
CREATE PROCEDURE sp_orders_delete
@ORDER_ID NUMERIC
AS
SET NOCOUNT ON
DECLARE @del_product int,
 @del_orders int,
-- Start a transaction.
BEGIN TRAN
-- Execute the DELETE statement for PRODUCT.
DELETE product
WHERE ORDER_ID = @ORDER_ID
-- Set a variable to the error value for
-- the DELETE statement.
SELECT @del_product = @@ERROR
-- Execute the DELETE statement for ORDERS.
DELETE orders
WHERE ORDER_ID = @ORDER_ID
-- Set a variable to the error value for
-- the DELETE statement.
SELECT @del_orders = @@ERROR
-- Test the error values.
IF @del_product = 0 AND @del_orders = 0
BEGIN
   -- Success. Commit the transaction.
   COMMIT TRAN
END
ELSE
BEGIN
   -- An error occurred, roll back the transaction.
   ROLLBACK TRAN
END
GO
 
Thanks, Peter

Reply via email to