oracle的timestamp字段类型绑定变量值不显示

问题现象

准备查看sql_id为dnmvngjb2bd2k的绑定变量值

SQL> select position,datatype_string,value_string,was_captured,LAST_CAPTURED from v$sql_bind_capture where sql_id = 'dnmvngjb2bd2k' order by POSITION,LAST_CAPTURED;

  POSITION DATATYPE_STRING                                              VALUE_STRING                                                           WAS LAST_CAPTURED
---------- ------------------------------------------------------------ ---------------------------------------------------------------------- --- ------------------
         1 VARCHAR2(128)                                                                                                                       NO
         1 VARCHAR2(128)                                                                                                                       NO
         2 TIMESTAMP                                                                                                                           YES 07-NOV-22
         2 TIMESTAMP                                                                                                                           YES 04-JAN-23

分析

was_captured显示yes表明已经捕获,但是查询没有显示。需要特殊处理转换。

解决方案

select name, position, datatype_string, was_captured, value_string,
anydata.accesstimestamp(value_anydata) from v$sql_bind_capture where sql_id ='dnmvngjb2bd2k';
NAME         POSITION DATATYPE_STRING      WAS VALUE_STRING                                                           ANYDATA.ACCESSTIMESTAMP(VALUE_ANYDATA)
---------- ---------- -------------------- --- ---------------------------------------------------------------------- ---------------------------------------------------------------------------
**:1                  1 VARCHAR2(128)        NO
:2                  2 TIMESTAMP            YES                                                                        20-DEC-22 06.11.14.000000000 AM
:1                  1 VARCHAR2(128)        NO
:2                  2 TIMESTAMP            YES                                                                        23-OCT-22 08.52.35.639000000 AM**

mos相关说明

V$SQL_BIND_CAPTURE Does Not Show The Value For Binds Of Type TIMESTAMP (文档 ID 444551.1)

SOLUTION

The bind value for the TIMESTAMP datatype could be obtained using a workaround of selecting the bind data via “ANYDATA.AccessTimestamp(value_anydata)”.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值