Toad 12.10.0.30 x64
Next sql is in script called sql_binds and I call it inside Editor like:
"@sql_binds 1 75undgc5qufbm 10"
where call is made of:
@sql_binds [iid] [sql_id] [last_number_of_days]
I got error (and in sqlplus it run without any errors)
SELECT iid,
b.sql_id,
PLAN_HASH_VALUE PLAN_HASH_V,
b.name,
b.position,
'"'||value_string||'"' value_string,
EXECS,
A_ROWS,
ELA_SECS,
ELAPSED_TIME_TOTAL,
snap_id,
to_char (begin_interval_time, 'DD.MM hh24:mi:ss,ssss') begin_interval_time,
to_char (end_interval_time, 'hh24:mi:ss,ssss') end_interval_time
FROM (
SELECT sh.instance_number iid,
sql_id,
PLAN_HASH_VALUE,
sh.snap_id,
begin_interval_time,
end_interval_time,
bind_data,
EXECUTIONS_DELTA EXECS,
ROWS_PROCESSED_DELTA A_ROWS,
CASE EXECUTIONS_DELTA
WHEN 0 THEN -1
ELSE ELAPSED_TIME_DELTA/1000000/EXECUTIONS_DELTA
END ELA_SECS,
ELAPSED_TIME_TOTAL/1000000/60 ELAPSED_TIME_TOTAL
FROM dba_hist_sqlstat sql, dba_hist_snapshot sh
WHERE 1 = 1
-- AND bind_data is not null
AND sql_id = '75'
AND sh.instance_number=1
AND SQL.INSTANCE_NUMBER=sh.instance_number
AND SQL.SNAP_ID = SH.SNAP_ID
AND begin_interval_time >= sysdate - undgc5qufbm
) x,
TABLE (DBMS_SQLTUNE.extract_binds (x.bind_data)) xx,
DBA_HIST_SQL_BIND_METADATA b
where b.sql_id = x.sql_id
AND b.position = xx.position
ORDER BY iid, snap_id, PLAN_HASH_VALUE, b.position
*
Error at line 36
ORA-00904: "UNDGC5QUFBM": invalid identifier
Script Terminated on line 20 of u:\sql\sql_binds.SQL.
What i see is that second parameter "75undgc5qufbm" is not passed correctly to sql. It is represented as
AND sql_id = '75'
so what results with wrong bind on third part
AND begin_interval_time >= sysdate - undgc5qufbm
I hope this helps and is enough to find a bug