CREATE proc dbo@ bill varchar (20),
@ message varchar (100) the output
As
Set nocount on
The SET XACT_ABORT ON
The BEGIN TRANSACTION
- define the inventory quantity
Declare @ KCSL int, @ 'moom' means' int, @ li_ckdm int
If (@ KCSL & gt; @ 'moom' means')
The begin of the inventory is greater than the number of outbound
The UPDATE G_HWKC SET CPSL=CPSL - @ 'moom' means' the WHERE CKDM=@ li_ckdm;
If (@ @ error & lt;> 0)
The begin
The ROLLBACK TRANSACTION.
The set @ message='change inventory failure!!!!! ';
The return - 1
End
End
The else - inventory shortage
The begin
The set @ message='inventory quantity is not enough,';
The ROLLBACK TRANSACTION.
The return - 1
End
COMMIT
RETURN 1
GO
How to call in the pb
DECLARE sp_sellcheck PROCEDURE FOR test
@ bill=: billbh, @ message=: ls_message OUTPUT;
The EXECUTE sp_sellcheck;
The FETCH sp_sellcheck INTO: ls_message;
The CLOSE sp_sellcheck;
If the stored procedure execution to ROLLBACK the TRANSACTION will appear mistake commit count can be
CodePudding user response:
Insufficient inventory database that if not happened thingsCodePudding user response:
There is no answer?CodePudding user response:
No, for the topCodePudding user response:
No, for the top