I have been developing some queries which will list the dependencies of
Stored Procedures (this is with DB2/UDB v8). In doing so, I have
noticed that dependencies are ignored if they occur in an insert into a
temporary table. For instance, if you have the following procedure:
CREATE PROCEDURE DBA.TEST
BEGIN
INSERT INTO SESSION.TEMP1 SELECT COUNT(*) FROM DBA.DEPARTMENT;
END
Then DBA.DEPARTMENT will not appear in the list of dependent objects
for this procedure. If you instead have (say) "INSERT INTO sometable
SELECT COUNT(*) FROM DBA.DEPARTMENT;" then DBA.DEPARTMENT will appear
in the dependency list.
Note that to get the dependency list I access SYSCAT.ROUTINEDEP with
the specific-name of the procedure - this gives me a package name, with
which I look up SYSCAT.PACKAGEDEP.
Perhaps, because temporary tables are not held in catalog, the insert
into the temporary table is ignored when DB2 is compiling the list of
dependent objects. Does anyone know whether this is the case, and
whether there is any way to get the list of dependent objects for
Stored Procedures such as these?
Thanks!
Phil Castle
Serge Rielau - 19 Jul 2006 02:15 GMT
> I have been developing some queries which will list the dependencies of
> Stored Procedures (this is with DB2/UDB v8). In doing so, I have
[quoted text clipped - 18 lines]
> whether there is any way to get the list of dependent objects for
> Stored Procedures such as these?
Your guess is correct. Any statement with "SESSION" in it is treated as
"VALIDATE RUN" that is it is not compiled untile first execution. Thus
no dependencies.
Cheers
Serge

Signature
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
IOD Conference
http://www.ibm.com/software/data/ondemandbusiness/conf2006/