Last active
December 21, 2015 00:48
-
-
Save davidhooey/6222961 to your computer and use it in GitHub Desktop.
Oracle PL/SQL script to simulate bind variables, time queries and generate execution plans.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set timing on; | |
set linesize 120; | |
-- | |
-- Bind Variable Setup | |
-- | |
variable Bind1 number; | |
variable Bind2 varchar2(2000); | |
exec :Bind1 := 0; | |
exec :Bind2 := 'Zero'; | |
-- | |
-- Query | |
-- | |
SELECT | |
* | |
FROM | |
my_table | |
WHERE | |
num_column = :Bind1 | |
AND | |
char_column = :Bind2; | |
-- | |
-- Query Execution Plan | |
-- | |
explain plan for | |
SELECT | |
* | |
FROM | |
my_table | |
WHERE | |
num_column = :Bind1 | |
AND | |
char_column = :Bind2; | |
select * from table(dbms_xplan.display); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment