Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Searching text clobs from user_views

donovan7800Jul 22 2013 — edited Jul 23 2013

Hi,

I needed to search for some specific text in the DDL of each of the views in a particular schema.  The text column of the user_views is LONG, and I looked at some old Tom's threads for converting long2clob, but found these processes to be really cumbersome, so I just opted to use DBMS_METADATA.GET_DDL instead even if it is a little slow.

One area I do not have a lot of experience with is searching clob fields.  I tried this but not sure what would be the appropriate function to use for something like this:

SELECT *

FROM

(

    SELECT

        object_name,

        object_type,

        DBMS_METADATA.GET_DDL(

            object_type => 'VIEW',

            NAME => object_name,

            SCHEMA => 'SCHEMA123'

        ) object_text

    FROM all_objects

    WHERE object_type = 'VIEW'

    AND owner = 'SCHEMA123'

)

WHERE contains(object_text, 'WHERE t.policy NOT LIKE') > 0; -- Show the names of all views that contain the matching text

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 20 2013
Added on Jul 22 2013
4 comments
1,747 views