开发者

Looking for a simple way to search in Oracle for a ID/Text [duplicate]

This question already has an answer here: 开发者_开发百科 Closed 11 years ago.

Possible Duplicate:

Oracle Search all tables all columns for string

I'm looking for a simple way to search in Oracle for a ID/Text in all tables. Any ideas?

I'm using currently SQL Developer. Thank you!


You can use the USER_TABLES and USER_TAB_COLUMNS system tables to read what tables and columns you have.

Using that information, you can write a procedure or anonymous code block to dynamically build a query for searching those tables. Then execute it using EXECUTE IMMEDIATE.

But beware that this will probably not perform too well in large databases. Also, you might want to check the data type of the column to decide wether to include it in your search or not.


You can execute this in sql-developer. (you might need to change %ID% to meet your naming convention)

SELECT 
    TABLE_NAME
    , COLUMN_NAME 
FROM 
    USER_TAB_COLUMNS 
WHERE 
    column_name like '%ID%'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜