Connecting Tech Pros Worldwide Help | Site Map

stored procedures dependencies

  #1  
Old October 28th, 2008, 09:25 PM
Jon.Hakkinen@gmail.com
Guest
 
Posts: n/a
Hi all,

I'm running db2 9 on windows.
I'm looking for a query to find dependencies between stored
procedures.
For instance if I have a procedure P that calls p1 and p2, I'd like to
know that.
I was looking at syscat.routinedep and syscat.packagedep but they
don't seem to do the job.
Even if P needs p1 and p2 to compile, it is still listed only once in
the syscat.routindep catalog. Apparently this view is designed to keep
the dependencies between routines and packages rather that
dependencies between routines
Also, the syscat.packagedep show only dependencies to views, tables,
etc, but not to other packages.
Is there any way I can query this? Thanks!
  #2  
Old October 29th, 2008, 11:15 AM
4.spam@mail.ru
Guest
 
Posts: n/a

re: stored procedures dependencies


On Oct 28, 11:23*pm, "Jon.Hakki...@gmail.com" <Jon.Hakki...@gmail.com>
wrote:
Quote:
Hi all,
>
I'm running db2 9 on windows.
I'm looking for a query to find dependencies between stored
procedures.
For instance if I have a procedure P that calls p1 and p2, I'd like to
know that.
I was looking at syscat.routinedep and syscat.packagedep but they
don't seem to do the job.
Even if P needs p1 and p2 to compile, it is still listed only once in
the syscat.routindep catalog. Apparently this view is designed to keep
the dependencies between routines and packages rather that
dependencies between routines
Also, the syscat.packagedep show only dependencies to views, tables,
etc, but not to other packages.
Is there any way I can query this? Thanks!
Hi Jon,

Package for routine P will depend on routines P1 and P2.
So you have to find that package and look at all routine instances
which this package depends on:

SELECT C.ROUTINESCHEMA, C.ROUTINENAME
FROM SYSCAT.ROUTINES R
JOIN SYSCAT.ROUTINEDEP D ON R.ROUTINESCHEMA=D.ROUTINESCHEMA AND
R.SPECIFICNAME=D.SPECIFICNAME
JOIN SYSCAT.PACKAGEDEP P ON P.PKGSCHEMA=D.BSCHEMA AND
P.PKGNAME=D.BNAME
JOIN SYSCAT.ROUTINES C ON P.BSCHEMA=C.ROUTINESCHEMA AND
P.BNAME=C.SPECIFICNAME
WHERE R.ROUTINESCHEMA='your_schema' and R.ROUTINENAME='P' AND
D.BTYPE='K'
AND P.BTYPE='F'

Hope this help.

Sincerely,
Mark B.
  #3  
Old October 29th, 2008, 03:45 PM
Jon.Hakkinen@gmail.com
Guest
 
Posts: n/a

re: stored procedures dependencies


On Oct 29, 6:09*am, 4.s...@mail.ru wrote:
Quote:
On Oct 28, 11:23*pm, "Jon.Hakki...@gmail.com" <Jon.Hakki...@gmail.com>
wrote:
>
>
>
Quote:
Hi all,
>
Quote:
I'm running db2 9 on windows.
I'm looking for a query to find dependencies between stored
procedures.
For instance if I have a procedure P that calls p1 and p2, I'd like to
know that.
I was looking at syscat.routinedep and syscat.packagedep but they
don't seem to do the job.
Even if P needs p1 and p2 to compile, it is still listed only once in
the syscat.routindep catalog. Apparently this view is designed to keep
the dependencies between routines and packages rather that
dependencies between routines
Also, the syscat.packagedep show only dependencies to views, tables,
etc, but not to other packages.
Is there any way I can query this? Thanks!
>
Hi Jon,
>
Package for routine P will depend on routines P1 and P2.
So you have to find that package and look at all routine instances
which this package depends on:
>
SELECT C.ROUTINESCHEMA, C.ROUTINENAME
FROM SYSCAT.ROUTINES R
JOIN SYSCAT.ROUTINEDEP D ON R.ROUTINESCHEMA=D.ROUTINESCHEMA AND
R.SPECIFICNAME=D.SPECIFICNAME
JOIN SYSCAT.PACKAGEDEP P ON P.PKGSCHEMA=D.BSCHEMA AND
P.PKGNAME=D.BNAME
JOIN SYSCAT.ROUTINES C ON P.BSCHEMA=C.ROUTINESCHEMA AND
P.BNAME=C.SPECIFICNAME
WHERE R.ROUTINESCHEMA='your_schema' and R.ROUTINENAME='P' AND
D.BTYPE='K'
AND P.BTYPE='F'
>
Hope this help.
>
Sincerely,
Mark B.
Great, it works like a charm, thanks a lot!!
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving stored procedures rick answers 8 February 12th, 2007 06:35 AM
Finding dependencies in stored procedures Praveen_db2 answers 2 July 24th, 2006 07:05 PM
Map Stored Procedure dependencies from ASP pages through methods to stored procedures dwilliams@newportgroup.com answers 6 November 22nd, 2005 07:05 PM
Map Stored Procedure dependencies from ASP pages through methods to stored procedures dwilliams@newportgroup.com answers 6 July 21st, 2005 10:54 PM