My question is: Is there a function UTL_MATCHthat works with CLOBrather than a VARCHAR2?
My specific problem: I am in an Oracle database. I have a bunch of pre-written queries that interact with Domo CenterView . Requests have variables defined in them ${variableName}. I need to rewrite these queries. I did not write the original, so instead of understanding what a good value for the variables should be, I want to run queries with the application and get what was requested from V$SQL.
So, my solution: Do UTL_MATCHin queries with variables in it and V$SQL.SQL_FULLTEXT. However UTL_MATCHlimited VARCHAR2, and the data type is V$SQL.SQL_FULLTEXTequal CLOB. So this is why I am looking for a function UTL_MATCHthat works with a type CLOB.
Any other tips on how to do this are welcome. Thank!
Change about tips. If you have a better idea of how to do this, let me tell you some information that I have at my disposal. I have about 100 queries, all of them are in the Excel table (the ones that have ${variableName}them). Therefore, I could easily use excel to write a query for me. I hope to combine all these queries together and copy the output to another sheet. Anyway, maybe this is useful if you think the best way to do this.
Example . Let's say I have the following query from Domo:
select department.dept_name
from department
where department.id = '${selectedDepartmentId}'
;
I want to call something like this:
select v.sql_fulltext
from v$sql v
where utl_match.jaro_winkler_similarity(v.sql_fulltext,
'select department.dept_name
from department
where department.id = ''${selectedDepartmentId}''') > 90
;
And we get something like this in response:
SQL_FULLTEXT
select department.dept_name
from department
where department.id = '154'
What I tried:
I tried to tune clob and drop it on varchar. I really hoped this would work, but it gives me an error. Here is the code:
select v.sql_fulltext
from v$sql v
where utl_match.jaro_winkler_similarity( cast( substr (v.sql_fulltext, 0, 4000) as varchar2 (4000)),
'select department.dept_name
from department
where department.id = ''${selectedDepartmentId}''') > 90
;
And here is the error:
ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 8000, maximum: 4000)
, , :
select cast(substr(v.sql_fulltext, 0, 4000) as varchar2 (4000))
from v$sql v
;
, , ...