473,395 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Search a string in entire schema

1
Hi,

I need to search a string(which might be a keyword containing a wild card character) in all tables in an Oracle schema.
The result that I need is a table contaning the tablename, columnname and the exact sting in which the string was found.

Could someone help me with a suitable code?

Thanks in advance.
Feb 2 '13 #1
3 13013
Anas Mosaad
185 128KB
You may create a stored procedure that take the keyword and schema name as input parameters and returns a table of all table names, columns and exact string. This procedure will query DBA_OBJECTS view to get all objects of type table in the target schema. Loop on all objects and get all columns names -not sure exactly which view that contains the column names- that are of string type and construct a query using the table name and columns name tp query that specific table. Execute the query using execute immediate. Finally, if a result was returned, add it to the table.

I'm not sure how efficient will be that procedure, but seems to me that it will take quite some time. Perhaps you will need to make that procedure pipelined.

Unfortunately, I'm not having an Oracle system currently to make a sample code for you. However, I hope the above description can help you.
Feb 2 '13 #2
zmbd
5,501 Expert Mod 4TB
Respectfully, your thread is subject to being removed because asking for someone to provide completed code or a completed project is against site policy. Please consult the FAQ and specific forum sticky threads for further information.

If however, you'd like to share what work you've already attempted, perhaps someone here would be willing to help.

In the meantime some heavy reading for you:
Displaying Information About Schema Objects
Syntax for Schema Objects and Parts in SQL Statements
Feb 2 '13 #3
try the below query
Expand|Select|Wrap|Line Numbers
  1. select * from user_source where text like ('%<your keyword>%')
But it will look only on PROCEDURE, FUNCTION, TRIGGER
or
try to write a ananomouys SQQ block to check the keyword which you are searching is there in the table script sql.
Like:
Expand|Select|Wrap|Line Numbers
  1. declare
  2. -- get List of all tables in your databsae 
  3. -- select object_name from user_objects where object_type='TABLE'
  4. begin
  5.     for C1 in (cursor WHICH HAS all YOUR table ) loop
  6.         --iterate each table
  7.             select * from ( select DBMS_METADATA.GET_DDL('TABLE', C1.<table name>)  from DUAL) where TT like ('%<YOUR KEYWORD>%')
  8.              if RETURNS RESULTS
  9.                  YOU GOT the table
  10.              else
  11.                  YOUR KEYWORD is not in the table SCRIPT
  12.              end;
  13.     end loop;
  14. end;

Please let me know if face any issue.
Feb 6 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: Freddie | last post by:
Happy new year! Since I have run out of alcohol, I'll ask a question that I haven't really worked out an answer for yet. Is there an elegant way to turn something like: > moo cow "farmer john"...
1
by: flam | last post by:
Hello, I am having a hard time spliting a string into an array for use in a search. Here is the situation. The user will input a search string. Normally I can just split the string by "split...
6
by: Michael | last post by:
Hi, Is there a straightforward way to export/import an entire schema in DB2 UDB? I am looking for the something similar to Oracle exp/imp. Thanks, Michael
5
by: davehansen22 | last post by:
Is there a way to generate a MySQL WHERE clause from a search string like this: "(dave OR hansen) php programmer" I would want to use the generated MySQL clause against a "memo" type field. ...
1
by: atl10spro | last post by:
Hello Everyone, I am new to MS Access and although I have created several different databases I lack the VB knowledge to code a search function. I am turning to your expertise for assistance. ...
2
by: beersa | last post by:
Hi All, I am looking for fastest search alogrithm in vb.net or vb2005. I write a code in vb2005 to find a string in given text file. The text file contains about 120,000 lines and search string...
2
by: sovixi | last post by:
Hi I want to search a text file (.txt) for words that I specify in my program. However, I can’t come up with any working solution. My program search string in a text file for ‘met|meeting|meets’ but...
1
by: Nitinkcv | last post by:
Hi, I have a textbox and a button. In my textbox i have to enter the query string(say shoes) and on clicking the button takes me to a page show all item related to the search string( in this case...
5
by: TC | last post by:
I use Visual Studio 2005 v8.0 on two different computers. On one, the "Find and Replace" dialog gives me the option to look in the "Entire Solution". On the other computer, the "Find and Replace"...
4
by: =?Utf-8?B?cm9kY2hhcg==?= | last post by:
hey all, is there a way to find a textbox id with a search string in the code-behind? thanks, rodchar
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.