Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7989891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:52:04+00:00 2026-06-04T12:52:04+00:00

My question is: Is there a UTL_MATCH -like function which works with a CLOB

  • 0

My question is: Is there a UTL_MATCH-like function which works with a CLOB rather than a VARCHAR2?

My specific problem is: I’m on an Oracle database. I have a bunch of pre-written queries which interface with Domo CenterView. The queries have variables in them defined by ${variableName}. I need to rewrite these queries. I didn’t write the original so instead of figuring out what a good value for the variables should be I want to run the queries with the application and get what the query was from V$SQL.

So my solution is: Do a UTL_MATCH on the queries with the variable stuff in it and V$SQL.SQL_FULLTEXT. However, UTL_MATCH is limited to VARCHAR2 and the datatype of V$SQL.SQL_FULLTEXT is CLOB. So, this is why I’m looking for a UTL_MATCH-like function which works with a CLOB datatype.

Any other tips of how to accomplish this are welcome. Thanks!

Edit, about the tips. If you have a better idea of how to do this, let me just tell you some information I’ve got at my disposal. I have about 100 queries, they’re all in an excel spreadsheet (the ones with the ${variableName} in them). So I could pretty easily use excel to write a query for me. I’m hoping to just union all those queries together and copy the output to another sheet. Anyway, maybe that’s helpful if you’re thinking there’s a better way to do this.

An 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 get something like this in return:

SQL_FULLTEXT
------------------------------------------
select department.dept_name
from department
where department.id = '154'

What I’ve tried:

I tried substringing the clob and casting it to a varchar. I was really hopeful this would work, but it gives me an error. Here’s 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’s the error:

ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 8000, maximum: 4000)

However, if I run this it works fine:

select cast(substr(v.sql_fulltext, 0, 4000) as varchar2 (4000))
from v$sql v
;

So I’m not sure what the problem is with casting the substring…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T12:52:05+00:00Added an answer on June 4, 2026 at 12:52 pm

    I ended up creating a custom function for it. Here’s the code:

    CREATE OR REPLACE function match_clob(clob_1 clob, clob_2 clob) return number as
    
    similar number := 0;
    sec_similar number := 0;
    sections number := 0;
    max_length number := 3949;
    length_1 number;
    length_2 number;
    vchar_1 varchar2 (3950);
    vchar_2 varchar2 (3950);
    
    begin
      length_1 := length(clob_1);
      length_2 := length(clob_2);
      --dbms_output.put_line('length_1: '||length_1);
      --dbms_output.put_line('length_2: '||length_2);
      IF length_1 > max_length or length_2 > max_length THEN
    
        FOR x IN 1 .. ceil(length_1 / max_length) LOOP
    
          --dbms_output.put_line('((x-1)*max_length) + 1'||(x-1)||' * '||max_length||' = '||(((x-1)*max_length) + 1));
    
          vchar_1 := substr(clob_1, ((x-1)*max_length) + 1, max_length);
          vchar_2 := substr(clob_2, ((x-1)*max_length) + 1, max_length);
    
    --      dbms_output.put_line('Section '||sections||' vchar_1: '||vchar_1||' ==> vchar_2: '||vchar_2);
    
          sec_similar := UTL_MATCH.JARO_WINKLER_SIMILARITY(vchar_1, vchar_2);
    
          --dbms_output.put_line('sec_similar: '||sec_similar);
    
          similar := similar + sec_similar;
          sections := sections + 1;
    
        END LOOP;
    
        --dbms_output.put_line('Similar: '||similar||' ==> Sections: '||sections);
        similar := similar / sections;
    
      ELSE
        similar := UTL_MATCH.JARO_WINKLER_SIMILARITY(clob_1,clob_2);
      END IF;
      --dbms_output.put_line('Overall Similar: '||similar);
       return(similar);
    end;
    /
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Short version question : Is there navigator.mozIsLocallyAvailable equivalent function that works on all browsers,
Here is the question: There are 5 sorted list A,B,C,D,E, which has the same
I was asked in my interview question there is a convenient PHP function you
Which is more efficient, "data.Length==0" or "data==string.Empty"? in this question there was an answer
newb question there. Having MySQL database/tables structure below: CREATE DATABASE `dbTest` CREATE TABLE IF
Question: Is there a way to make a function object in python using strings?
I feel like this is a very basic CSS question: There seems to be
I need help about a query in oracle 10g, Here is my question: There
It's an interview question: There are 1 billion cell-phone numbers which has 11 digits,
Newbie question: There are three types of Asp.Net controls : HTML server controls, Web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.