BEGINspecific error message 6401, level 16, state 1, process PRO_DAM_BGY_WDGL_BODY, line 152
The SET @ P_APPLY_NO=' ';
The SET @ P_OUT_MSG=' ';
- 1, @ P_COMPANY_CODE (ownership enterprises ten code) + @ P_RELATION_COMPANY_CODE (relationship between enterprise ten code) + @ P_FILE_TYPE query document types, whether it is
-- 1.1 if not, RETURN directly, without an error, the other party may file is more than we, if we have no configuration, said we don't need, don't need to file, we don't complain, don't deal with good,
IF NOT the EXISTS (
SELECT 1 FROM dbo. DAM_BGD_FILE_TYPE WHERE COMPANY_CODE=@ P_COMPANY_CODE AND RELATION_COMPANY_CODE=@ P_RELATION_COMPANY_CODE
AND PAGE_TYPE='FILE_TYPE'
AND TYPE=@ P_FILE_TYPE
)
The BEGIN
The RETURN;
END
- 2, @ P_COMPANY_CODE (ownership enterprises ten code) + @ P_RELATION_COMPANY_CODE (relationship between enterprise ten code) + @ P_FILE_TYPE query naming rules, whether it is
- if there is a 2.1, record the prefix, suffix, connector, for later use,
- 2.2 if there is no error,
IF NOT the EXISTS (
SELECT 1 FROM dbo. DAM_BGD_FILE_TYPE WHERE COMPANY_CODE=@ P_COMPANY_CODE AND RELATION_COMPANY_CODE=@ P_RELATION_COMPANY_CODE
AND PAGE_TYPE='FILE_NAME'
AND TYPE=@ P_FILE_TYPE
)
The BEGIN
The SET @ P_OUT_MSG='there is no naming rules;
RETURN
END
BEGIN the TRY
The BEGIN TRAN TRANS
SELECT @ V_APPLY_NO=APPLY_NO, @ V_HEAD_GUID=GUID FROM dbo. DAM_BGD_INFO
WHERE COMPANY_CODE=@ P_COMPANY_CODE
AND RELATION_COMPANY_CODE=@ P_RELATION_COMPANY_CODE
AND the ENTRY_ID=@ P_ENTRY_ID
IF ISNULL (@ V_HEAD_GUID, ' ')='- that there is no data, new header
The BEGIN
The EXEC dbo. PRO_DAM_BGH_INSERT_WDGL_HEAD @ P_COMPANY_CODE=@ P_COMPANY_CODE - varchar (20)
@ P_I_E=@ P_I_E - varchar (5)
@ P_M_P=@ P_M_P - varchar (5)
@ P_D_DATE=@ P_D_DATE - varchar (100)
@ P_BOND_INVT_NO=@ P_BOND_INVT_NO - varchar (50)
@ P_ENTRY_ID=@ P_ENTRY_ID - varchar (18)
@ P_DEFAULT_BIZ_TYPE=@ P_DEFAULT_BIZ_TYPE - varchar (50)
@ P_CONTROL_NO=@ P_CONTROL_NO - varchar (255)
@ P_CONTRACT_NO=@ P_CONTRACT_NO - varchar (255)
@ P_RELATION_COMPANY_CODE=@ P_RELATION_COMPANY_CODE - varchar (36)
@ P_DCLCUS_FLAG="' - varchar (1)
@ P_DCLCUS_TYPECD="' - varchar (25)
@ P_USER_NO="' - varchar (50)
@ P_APPLY_NO=@ P_APPLY_NO OUTPUT - varchar (50)
@ P_OUT_MSG=@ P_OUT_MSG OUTPUT - varchar (500)
@ P_OUT_LOG=@ P_OUT_LOG OUTPUT - varchar (1000)
IF ISNULL (@ P_APPLY_NO, ' ')='
The BEGIN
RAISERROR (' Error raised in the TRY block. ', -- Message text.
16. -- Severity.
1 - State.
);
END
END
IF ISNULL (@ P_DEFAULT_BIZ_TYPE, ' ')='
The BEGIN
The SET @ P_DEFAULT_BIZ_TYPE='ENTRY_ID';
END
The EXECUTE dbo. PRO_DAM_INSERT_WDGL_DETAIL @ P_APPLY_NO=@ P_APPLY_NO - varchar (50)
@ P_FILE_TYPE=@ P_FILE_TYPE - varchar (20)
@ P_FILE_PATH=@ P_FILE_PATH - varchar (255)
@ P_FILE_EXT=@ P_FILE_EXT - varchar (10)
@ P_BIZ_TYPE=@ P_DEFAULT_BIZ_TYPE - varchar (36) - the default correlation single type
@ P_FILE_SOURCE="' - varchar (50)
@ P_FILE_SIZE=@ P_FILE_SIZE - float
@ P_FILE_NO="' - varchar (50)
@ P_OUT_FILE_PATH=@ P_WDGL_FILE_PATH OUTPUT,
@ P_OUT_MSG=@ P_OUT_MSG OUTPUT - varchar (500)
IF ISNULL (@ P_OUT_MSG, ' ') & lt;> '
The BEGIN
RAISERROR (' Error raised in the TRY block. ', -- Message text.
16. -- Severity.
1 - State.
);
END
The EXECUTE dbo. PRO_DAM_BGY_CHECK_AND_INSERT_SEND_TASK
@ P_APPLY_NO=@ P_APPLY_NO,
@ P_OUT_MSG=@ P_OUT_MSG OUTPUT - varchar (500)
END the TRY
The BEGIN CATCH
IF ISNULL (@ P_OUT_MSG, ' ')='
The BEGIN
- show that no mistake -
COMMIT the TRANSACTION TRANS
END
The ELSE
The BEGIN
-///-- -- -- -- -- -- -- -- -- -- --
The ROLLBACK TRANSACTION TRANS
END
END the CATCH;
END
Unable to roll back the TRANS, can not find the name of the transaction or savepoint,
Message 266, level 16, state 2, process PRO_DAM_BGY_WDGL_BODY, row 0
After the EXECUTE transaction count the number of instructions BEGIN and COMMIT statement do not match, a count=4, the current count=5,
-- -- -- -- -- -- -- -- I have two new tables were two storage, there are basic check logic, I wrote PRO_DAM_BGY_WDGL_BODY again, the two tables, new
Hope that through the way of transaction consistency, as a result, an error, someone can provide specific ideas
CodePudding user response:
Each must Begin tran and only have a commit tran or rollback tran to match,Your code seems to have a logical error: raiserror if not executed, or the execution without any error occurs, it will not perform to catch it, so that only the begin tran, no commit or rollback matching,
CodePudding user response:
Should COMMIT TRAN TRANS before END the TRYCodePudding user response: