|
|
|
|
|
|
| Author |
Message |
phil@querytool.com *nix forums beginner
Joined: 01 Mar 2005
Posts: 3
|
Posted: Tue Jul 18, 2006 10:53 pm Post subject:
Procedure Dependencies and Temporary Tables
|
|
|
I have been developing some queries which will list the dependencies of
Stored Procedures (this is with DB2/UDB v . 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 |
|
| Back to top |
|
 |
Serge Rielau *nix forums Guru
Joined: 29 Apr 2005
Posts: 1583
|
Posted: Wed Jul 19, 2006 1:15 am Post subject:
Re: Procedure Dependencies and Temporary Tables
|
|
|
phil@querytool.com wrote:
| Quote: | I have been developing some queries which will list the dependencies of
Stored Procedures (this is with DB2/UDB v . 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?
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
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
IOD Conference
http://www.ibm.com/software/data/ondemandbusiness/conf2006/ |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Mon Dec 01, 2008 11:51 pm | All times are GMT
|
|
Credit Card | Free Credit Score | Credit Card Debt Consolidation | Secured Loans | Loans
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|