USP_BANKACCOUNTDEPOSITCORRECTION_DELETE
Executes the "Bank Account Deposit Correction: Delete" record operation.
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN | Input parameter indicating the ID of the record being deleted. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the delete. |
Definition
Copy
CREATE procedure dbo.USP_BANKACCOUNTDEPOSITCORRECTION_DELETE
(
@ID uniqueidentifier,
@CHANGEAGENTID uniqueidentifier
)
as
set nocount on;
declare @BASEEXCHANGERATEID uniqueidentifier;
select @BASEEXCHANGERATEID = BASEEXCHANGERATEID
from dbo.BANKACCOUNTDEPOSITCORRECTION where ID = @ID;
begin try
declare @contextCache varbinary(128);
-- cache current context information
set @contextCache = CONTEXT_INFO();
-- set CONTEXT_INFO to @CHANGEAGENTID
if not @CHANGEAGENTID is null
set CONTEXT_INFO @CHANGEAGENTID;
--delete all the distributions related to these transactions
delete from dbo.GLTRANSACTION where ID in (select GLTRANSACTIONID from dbo.BANKACCOUNTDEPOSITCORRECTIONGLDISTRIBUTION where BANKACCOUNTDEPOSITCORRECTIONID = @ID)
exec dbo.USP_BANKACCOUNTDEPOSITCORRECTION_DELETEBYID_WITHCHANGEAGENTID @ID, @CHANGEAGENTID;
--delete spot rates that are being used
delete dbo.CURRENCYEXCHANGERATE where TYPECODE = 2 and ID = @BASEEXCHANGERATEID;
-- reset CONTEXT_INFO to previous value
if not @contextCache is null
set CONTEXT_INFO @contextCache
end try
begin catch
exec dbo.USP_RAISE_ERROR
return 1
end catch
return 0;