Solved

search for a string in all stored procedures and functions

Posted on 2011-03-10
8
652 Views
Last Modified: 2012-05-11
Hi,

  I'm on DB2 UDB 8.2
  Is there a way to query the database against all the procedures/functions/triggers to see if a particular string has been used?
  Please advise.
0
Comment
Question by:pvsbandi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 

Author Comment

by:pvsbandi
ID: 35096728
Thanks! I queried something like this.
select distinct routinename from SYSCAT.ROUTINES 
where upper(text) like '%SUBSIDY%'

Open in new window


But upper is not working on this column. If i don't use upper or lower, i'm loosing many procedures which use subsidy in different case sensitivities.

How can i run this? Please help.
0
 
LVL 37

Expert Comment

by:momi_sabag
ID: 35096880
what is subsidy?
is it an object name?
if so, you can search for it in the tables that document object dependencies
0
Quiz: What Do These Organizations Have In Common?

Hint: Their teams ended up taking quizzes, too.

 

Author Comment

by:pvsbandi
ID: 35096946
The whole purpose of this search is to get all the routines that use Subsidy, as it is changing into something else. So, this search should get us a list of all procedures/functions etc that use subsidy.

  Can't we use UPPER() or LOWER() on a CLOB?
0
 
LVL 37

Expert Comment

by:momi_sabag
ID: 35096954
you can't
and i will ask again
is subsidy a name of another object (table / view) ?
0
 

Author Comment

by:pvsbandi
ID: 35097001
subsidy is a part of different columns like adoption_subsidy;guardian_subsidy, pay_subsidy etc.
0
 
LVL 37

Accepted Solution

by:
momi_sabag earned 500 total points
ID: 35097017
so this is not good

you can try to use the db2look utility to generate create statements of all your objects, and then use a regular text search tool (like notepad) to find that value

or, you can write a procedure that loops through the clob column, cuts it into smaller varchar values and check against them but it would be far more complicated
0
 

Author Closing Comment

by:pvsbandi
ID: 35097249
Thanks Momi!
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
Recursive SQL in UDB/LUW (you can use 'recursive' and 'SQL' in the same sentence) A growing number of database queries lend themselves to recursive solutions.  It's not always easy to spot when recursion is called for, especially for people una…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

689 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question