Search This Blog

Tuesday, June 19, 2012

Session Trace and Bind Variables

AS SYS


----------

execute dbms_system.set_sql_trace_in_session(144,951, true);



SQL_ID

-------------

SQL_TEXT

--------------------------------------------------------------------------------

4nsz84fyk5wf5

select ANNOUNCEMENTS_TITLE from ann where ANNOUNCEMENTS_ID= :ann_id







SQL> SELECT

2 a.sql_text,

3 b.name,

4 b.position,

5 b.datatype_string,

6 b.value_string

7 FROM

8 v$sql_bind_capture b,

9 v$sqlarea a

10 WHERE

11 b.sql_id = '4nsz84fyk5wf5'

12 AND

13 b.sql_id = a.sql_id;



SQL_TEXT

---------------------------------------------------------------------------

NAME POSITION DATATYPE_STRING

------------------------------ ---------- ---------------

VALUE_STRING

---------------------------------------------------------------------------

select ANNOUNCEMENTS_TITLE from ann where ANNOUNCEMENTS_ID= :ann_id

:ANN_ID 1 NUMBER

39





AS USER

---------

variable ann_id number

exec :ann_id := 39

select ANNOUNCEMENTS_TITLE from ann where ANNOUNCEMENTS_ID= :ann_id;