Oracle 视图 V$SQL_BIND_METADATA 官方解释,作用,如何使用详细说明

本站中文解释

V$SQL_BIND_METADATA 是 Oracle 中的动态视图,它查询可重用语句的绑定信息。它包括变量名、变量类型、变量值的描述性属性以及与此语句关联的表和列的信息。SQL 引擎使用这些属性来收集优化信息。

使用V$SQL_BIND_METADATA视图获取SQL语句的绑定信息,要做到这一点,请确保SQL_ID字段已被正确填充,以便根据SQL_TEXT字段重新构造引用语句并将绑定变量值传递给语句的实例。可以使用以下SQL查询V$SQL_BIND_METADATA:

SELECT *
FROM V$SQL_BIND_METADATA
WHERE SQL_ID = :sql_id;

官方英文解释

V$SQL_BIND_METADATA describes metadata related to bind variables.

V$SQL_BIND_METADATA describes, for each distinct bind variable in each cursor owned by the session querying this view:

  • Bind metadata provided by the client, if the bind variable is user defined

  • Metadata based on the underlying literal, if the CURSOR_SHARING parameter is set to FORCE and the bind variable is system-generated.

Column Datatype Description

ADDRESS

RAW(4 | 8)

Memory address of the child cursor that owns this bind variable

POSITION

NUMBER

Bind position

DATATYPE

NUMBER

Internal identifier for the bind data type. Beginning in Oracle Database 12c, a number representing a PL/SQL data type can appear in this column.

MAX_LENGTH

NUMBER

Maximum length of the bind value

ARRAY_LEN

NUMBER

Maximum number of array elements (for array binds only)

BIND_NAME

VARCHAR2(128)

User-defined or system-generated bind variable name (if used)

CON_ID

NUMBER

The ID of the container to which the data pertains. Possible values include:

  • 0: This value is used for rows containing data that pertain to the entire CDB. This value is also used for rows in non-CDBs.

  • 1: This value is used for rows containing data that pertain to only the root

  • n: Where n is the applicable container ID for the rows containing data

See Also:

“CURSOR_SHARING”


数据运维技术 » Oracle 视图 V$SQL_BIND_METADATA 官方解释,作用,如何使用详细说明