Oracle BI EE 11g – Reporting on CLOBs – Lookups
August 20th, 2010 by Venkatakrishnan J
One important new feature of BI EE 11g is the ability to report on CLOBs and other large objects. The main difference between normal Varchar/Numeric columns and LOB datatype columns is, LOB columns do not support GROUP BY, DISTINCT & ORDER BY operations on them (from a reporting perspective). Any query that BI EE generates will always have a GROUP BY or a DISTINCT in it. So, in 10g reporting on LOB columns have always been an issue(will result in Ora-XXXX errors). One had to resort to different types of workarounds for reporting on LOB columns.
In BI EE 11g, its possible to isolate different columns from the GROUP BY/DISTINCT operations by using the SPARSE/DENSE lookup operators. I have already blogged about how Sparse & Dense lookups work in general here. Lets see how the same can be used for CLOB reporting. To demonstrate this i shall be using the v$sql view. This view basically contains a CLOB called SQL_FULLTEXT. This column contains the SQL queries stored in the form of CLOB, that are fired to the Oracle database by multiple users. Our aim is to report on this view and display the SQL Queries from the CLOB column.
We start with granting select on the v_$sql view to SH schema and then importing it in BI EE.
Then edit the column properties of the SQL_FULLTEXT column and increase the size to 100000 (or higher) so that BI EE can display the values from CLOB.
Start with modeling a dimension and a fact in the BMM layer as shown below
Then create another logical table (same as the dimension) containing SQL_ID as the primary key. The idea is to use this primary key and show the SQL_FULLTEXT using a DENSE lookup. Mark the new logical table as a lookup table.
In the dimension logical table create a new column and use the following formula to derive the SQL_FULLTEXT as a lookup column. This will always push a separate SQL without DISTINCT/GROUP BYs on the SQL_FULLTEXT column.
Lookup (DENSE "LOB Reporting"."Lookup - CLOB"."SQL Full Text" , "LOB Reporting"."Lookup - CLOB"."SQL ID" )
Lets now include this new column in the presentation layer and use it for reporting.
As you see, we should now be able to see the CLOB data without any restrictions. If we look at the query generated, you can basically see 2 separate SQL queries, one with the group-by and the other with just the lookup.
![]()
select sum(T43900.ROWS_PROCESSED) as c1,
T43900.SQL_ID as c2
from
SYS.V_$SQL T43900
group by T43900.SQL_ID
select T43900.SQL_FULLTEXT as c1,
T43900.SQL_ID as c2
from
SYS.V_$SQL T43900
In BI EE 11g, usage tracking can now log logical sql’s greater than 4000 characters into a separate CLOB column.


August 21st, 2010 at 5:38 pm
Hi Venkat,
I really admire the way you think about implementing different use cases with the available options in OBIEE.
Great work.
Thanks.
August 29th, 2010 at 6:37 am
Excellent. I see that in the LOOKUP Function. the parameters used are the columns from the Lookup table. How does BI Server know which column has to be used from the dimension to lookup?
June 8th, 2011 at 8:25 pm
Hi Venkat,
Could you please go into more detail on this statement: “In BI EE 11g, usage tracking can now log logical sql’s greater than 4000 characters into a separate CLOB column.” It does not appear that Oracle has enabled this out of the box. How do we take advantage of this in 11G and can we tie the Usage Tracking record to the v$SQL to make UT even more valuable to us?
Thanks!
November 10th, 2011 at 11:46 am
Hi Venkat,
I followed all the steps as above and created logical table and column. But when I add that logical column to the report and click on the filter option it is displaying all data correctly, but at the same time when I click on the results tab it is failing with this error “OPR4ONWY:U9IM8TAC:OI2DL65P
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 43119] Query Failed: [nQSError: 17001] Oracle Error code: 932, message: ORA-00932: inconsistent datatypes: expected – got CLOB at OCI call OCIStmtExecute. [nQSError: 17010] SQL statement preparation failed. (HY000)
SQL Issued: SELECT 0 s_0, “P6 Project History”.”Project Issue – Logical”.”Note – Logical” s_1 FROM “P6 Project History” . Please help.