How to obtain the variable value bound to an oraclesql statement

Source: Internet
Author: User

How to obtain the variable value bound to an oraclesql statement

When diagnosing SQL Performance problems, we sometimes need to obtain the actual value of the variable it binds, and then bring the actual value into the SQL statement, use the original SQL statement to form a select statement (with the where condition). Execute the statement to check the selectivity.

This document describes how to obtain the bound variable value. Thanks for the help of elders who have prepared this article.

This article applies to databases with oracle 10 Gb or later.

Alter session set nls_date_format = 'yyyy-mm-dd, hh24: mi: ss '; set linesize 400 col SQL _Id format a20 col name format a20 col datatype_string format a14 col value_string format a20 -- This SQL statement reads the bound variable value information from the memory. If it is not in the memory, select SQL _id, name, datatype_string, last_captured, value_string from v $ SQL _bind_capture where SQL _id = 'dxfcacn4t4ppw' order by LAST_CAPTURED, POSITION; -- This SQL statement reads binding variable value information from awr select instance_number, SQL _id, name, datatype_string, last_captured, value_string from dba_hist_sqlbind where SQL _id = 'hangzhou' order by LAST_CAPTURED, POSITION;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.