views:

58

answers:

1

Hello, I have a Java application, and use OJB as my ORM technology. I have an Oracle XE installation locally to develop against. The problem is when I need to debug a problem, I like looking at the SQL output. Here is an example of SQL I can view through the "Top SQL" interface in Oracle XE:

 select a_bunch_of_fields
 from KREW_DOC_TYP_T A0
 WHERE ((UPPER(A0.DOC_TYP_NM) LIKE :1) AND A0.ACTV_IND = :2) AND A0.CUR_IND = :3

The problem is I would like to see the real value instead of ":1". I can't seem to find how I can configure this. I know the real values are working, because the application is responding as expected, for the most part (hence the bugs I am working on).

Thanks, Jay

A: 

One quick and dirty way is to look in the provided database views (v$sql_bind_capture and v$sqlarea). In the SQL below, I just added a like clause to match the sql statement you have above, you will then get a row for each bind variable and it's value. To target a very specific SQL statement you want the sql_id for your query.

SELECT a.sql_text, b.NAME, b.POSITION, b.datatype_string, b.value_string
  FROM v$sql_bind_capture b, v$sqlarea b
 WHERE b.sql_id = a.sql_id
  and a.sql_text like '%UPPER(A0.DOC_TYP_NM) LIKE :1%'

Output (without the SQL the result would look look something like this):

"NAME","POSITION","DATATYPE_STRING","VALUE_STRING"
":B1","2","NUMBER","1001"
Brian