Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> FW: need to compare long data against varchar2
This worked for me. I got the getlong code from a post by ORACLEtune on
expertsexchange.
select object_name
from dba_objects
where object_id in (select obj#
from sys.view$ where getlong('sys.view$','text',rowid) like'%<table_name>%')
create or replace function getlong( p_tname in varchar2, p_cname in varchar2, p_rowid in rowid ) return varchar2 as l_cursor integer default dbms_sql.open_cursor; l_n number; l_long_val varchar2(4000); l_long_len number; l_buflen number := 4000; l_curpos number := 0; begin dbms_sql.parse( l_cursor, 'select ' || p_cname || ' from ' || p_tname || ' where rowid = :x', dbms_sql.native ); dbms_sql.bind_variable( l_cursor, ':x', p_rowid ); dbms_sql.define_column_long(l_cursor, 1); l_n := dbms_sql.execute(l_cursor); if (dbms_sql.fetch_rows(l_cursor)>0) then dbms_sql.column_value_long(l_cursor, 1, l_buflen, l_curpos , l_long_val, l_long_len ); end if; dbms_sql.close_cursor(l_cursor); return l_long_val;
-----Original Message-----
Sent: Friday, February 21, 2003 10:20 AM
To: oracle-l (ORACLE-L_at_fatcity.com)
I need to devise a method of comparing the TEXT column of dba_views against varchar2. End result I want to find the views that reference a particular table within its text.
example (which ~obviously~ will not work):
select view_name
from dba_views
where text like '%<table_name>%
I understand that a query or PL/SQL procedure of this sort would be long running, but getting the concept to work would be a start.
TIA
--
Please see the official ORACLE-L FAQ: http://www.orafaq.net
--
Author: Markham, Richard
INET: RMarkham_at_hafeleamericas.com
Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services ---------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Fri Feb 21 2003 - 09:44:20 CST
![]() |
![]() |