To obtain a method for binding variable values in an Oracle SQL statement

Source: Internet
Author: User

When diagnosing a performance problem with SQL, we sometimes need to get the actual value of its bound variable, and then bring the actual value into the SQL statement, make a SELECT statement with the original SQL (with the Where condition), actually execute it, and see what the selectivity is.

This is the way to get the value of its bound variable. The writing of this article has been helped by withered flourish elders, and I thank you for that.

This article applies to DB with Oracle 10G or later.

Alter session Set Nls_date_format = ' Yyyy-mm-dd,hh24:mi:ss '; set linesize 400col sql_id format a20col name format A20col da tatype_string format a14col value_string format A20-this SQL reads bound variable value information from memory, if not in memory, uses the next sqlselect 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 reads the binding variable value information from the AWR select Instance_number, Sql_id,name, datatype_string, last_captured,value_string from Dba_hist_ SQLBind where sql_id= 'Fahv8x6ngrb50' 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.