Skip to Main Content

SQL Developer

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!

Search a table or tables for a value, not a column

EricDBAEDQSep 26 2017 — edited Sep 27 2017

Is there a way to search a whole table or tables for a certain value? I created a stored procedure to search all tables for a column and figured I could change it to search for a value. I have provided my stored procedure below:

CLEAR SCREEN
SET VERIFY OFF
ACCEPT column_name CHAR PROMPT 'Please insert column name: '
CLEAR SCREEN;
SELECT DISTINCT table_name
FROM all_tab_columns
WHERE column_name = TRIM(UPPER('&column_name'));
SET TERM ON

ACCEPT response CHAR PROMPT 'Would you like to search for another column? '

COLUMN script new_value script

SET TERM OFF

SELECT CASE LOWER('&response.') WHEN 'yes' THEN 'columnfinder' ELSE 'stop' END AS script
FROM DUAL;

SET TERM ON

@&script.

I apologize I tried to post the code using the tools above but it didn't work.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 25 2017
Added on Sep 26 2017
17 comments
4,345 views