Search code examples
oracle-databaseoracle12c

Does sql_id change if bind variable values are changed


I have a sql_id. The corresponding SELECT SQL query has 4 bind variables. There is a program created by me which lets me know that it ran for 1000 times in the last 1 month. So basically I want to know that all 1000 times the same bind variable was used or not. For the latest one, I got the bind variable values from v$sql_bind_capture.

So is it that whatever is the latest value in v$sql_bind_capture is the same used all 1000 times? Does sql_id generation consider the bind value for generation of sql_id or it is the query without the bind value that is used to generate sql_id?

Thanks Tarun


Solution

  • No, different bind value passed each time will not cause the SQL_ID to change. A different bind value passed may cause the sql plan hash value to change (PHV) but not the SQL_ID.