重庆思庄oracle技术分享-merge语句中存在两个长绑定变量导致ORA-03137

Oracle Database - Enterprise Edition - Version 11.2.0.4 and later
Information in this document applies to any platform.

SYMPTOMS
Merge statement fails with:
ORA-03137: TTC protocol internal error : [12333] [254] [64] [123] [] [] [] []

The merge statement as such uses many bind variables as shown by the current sql in the trace file:
----- Current SQL Statement for this session (sql_id=…) -----
MERGE INTO ORDER_ USING (SELECT :1 SystemOrderId FROM DUAL) I ON (ORDER_.SystemOrderId=I.SystemOrderId)
WHEN MATCHED THEN UPDATE SET SourceSystem=:2 ,AssetType=:3 ,OrderType=:4 , …
WHEN NOT MATCHED THEN INSERT (SourceSystem, AssetType, OrderType, …) VALUES (:49 ,:50 ,:51 , …)

Note that the call stack of an ORA-3137 [12333] is rather generic and hardly useable to identify a specific issue.

CAUSE
Merge is using two LONG bind variables as shown in the trace file:

Bind#44
oacdty=01 mxl=4001(4528) mxlc=00 mal=00 scl=00 pre=00
oacflg=03 fl2=1000010 frm=01 csi=873 siz=4000 off=0
kxsbbbfp=ffffffff7cd20d50 bln=4000 avl=4001 flg=25

Bind#92
oacdty=01 mxl=4001(4528) mxlc=00 mal=00 scl=00 pre=00
oacflg=03 fl2=1000010 frm=01 csi=873 siz=4000 off=0
kxsbbbfp=ffffffff7cd3cde0 bln=4000 avl=4001 flg=25

Using LONG bind variables is not supported as clarified in
Bug 20021406 - ORA-3137: TTC PROTOCOL INTERNAL ERROR : [12333] ON MERGE STATEMENT
which was closed with status “Not a Bug”.

The bug report states: “Oracle server interface is not designed to take LONG bind as duplicate bind OR more than one LONG bind (bind length more than 4K). So this is not supported.”

From the trace file, we can confirm that two bind variables are used for respectively updating and inserting on the same LONG column.

SOLUTION
The merge statement failing is the expected behaviour as it is not supported to have two long bind variables on the same SQL statement.

To solve the issue, please change the MERGE statement and avoid to have two long bind variables on the same SQL statement.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值