Skip to content

Commit 3a53535

Browse files
committed
Two Examples to search the long text field in DBA_VIEWS
1 parent 91595fb commit 3a53535

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

Diff for: search_long.sql

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
REM Filename : search_long.sql
2+
REM Author : Craig Richards
3+
REM Created : 15-March-2007
4+
REM Version : 1.0
5+
REM Modifications :
6+
REM
7+
REM Description : Two Examples to search the long text field in DBA_VIEWS
8+
9+
PROMPT Edit the two pieces of code below to enable you to search the long field in DBA_VIEWS
10+
PROMPT
11+
PROMPT In the example below enter the search text in lower case
12+
13+
REM SET SERVEROUTPUT ON SIZE 10000
14+
REM DECLARE
15+
REM CURSOR c_dbv IS
16+
REM SELECT owner,view_name,text
17+
REM FROM all_views;
18+
REM txt VARCHAR(32000);
19+
REM searchstring VARCHAR(100) := 'scott.emp';
20+
REM BEGIN
21+
REM FOR ct IN c_dbv LOOP
22+
REM IF INSTR(LOWER(ct.text), LOWER(searchstring)) > 0 THEN
23+
REM DBMS_OUTPUT.PUT_LINE(ct.owner||'.'||ct.view_name);
24+
REM END IF;
25+
REM END LOOP;
26+
REM END;
27+
REM /
28+
29+
30+
REM SET SERVEROUTPUT ON
31+
REM
32+
REM BEGIN
33+
REM FOR x IN (SELECT * FROM dba_views ) LOOP
34+
REM IF ( x.view_text LIKE '%customer_address%' ) THEN
35+
REM DBMS_OUTPUT.PUT_LINE( x.view_name );
36+
REM END IF;
37+
REM END LOOP;
38+
REM END;
39+
REM /
40+
41+
PROMPT The above sample will work as long as the view text is 32k or less.
42+
43+
REM End of Script

0 commit comments

Comments
 (0)