473,881 Members | 1,561 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Procedure Dependencies and Temporary Tables

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.ROUTINED EP with
the specific-name of the procedure - this gives me a package name, with
which I look up SYSCAT.PACKAGED EP.

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

Jul 18 '06 #1
1 2781
ph**@querytool. com wrote:
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.ROUTINED EP with
the specific-name of the procedure - this gives me a package name, with
which I look up SYSCAT.PACKAGED EP.

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/ond...ness/conf2006/
Jul 19 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
6024
by: Jarrod Morrison | last post by:
Hi All Im generally a vb programmer and am used to referencing multiple records returned from a query performed on an sql database and im trying to move some functions of my software into sql stored procedures. So far ive been able to move the functions relatively easily but im unsure about how to output multiple values from an sql stored procedure. By this i mean for example one of the stored procedures may take your username and return...
2
4965
by: Jose Perez | last post by:
Dear All, I have 2 SP's, one (let's call it sp_A) which returns a list of files and another (let's call it sp_B) which recursively looks through a menu table to give me the location of the file. I call sp_B within sp_A as I want to return the data in one table. I am having trouble in getting the results back. Both SP's work independantly but when they are put together I get an error. Any help will be greatly appreciated!!
8
7952
by: Thomasb | last post by:
With a background in MS SQL Server programming I'm used to temporary tables. Have just started to work with DB2 ver 7 on z/OS and stumbled into the concept of GLOBAL TEMPORARY TABLE. I have created a temporary database with a tables space. Verified that DECLARE GLOBAL TEMPORARY TABLE TEMP (A INTEGER); INSERT INTO SESSION.TEMP VALUES(10); SELECT A FROM SESSION.TEMP; works from a query tool.
1
5300
by: Roman Prigozhin | last post by:
Hi all, I have one stored procedure where I defined 3 temporary tables, which i return back to java. I want to have 3 separate sub procedures which would go after the data and fill out these temporary tables. Question: Is it possible to a) Pass a pointer to the temporary table from one procedure and have it filled out in the other procedure, then return controll to the caller ?
4
3896
by: Guru | last post by:
Hi All I am using a Global Temporary table in the Stored procedure and i am creating index for a column in that temporary table.When i am executing it. It is not taking that index. I checked using explain plan. But if i run the runstats in the CLP for that temporary table it is taking the index. How i have to implement in the Stored procedure itself? Warm Regards Guru
2
1597
by: Bernard Dhooghe | last post by:
When a Function returning a scalar is written in C, it is easy to change the code, by just creating a new loadable object. When the code is written in SQL procedure language, how to replace the code when there are dependencies? The restrict is default in drop function, there is no no-restrict capability. Remark: was already posten in the newsgroups, concerning dependencies on triggers. Suggestion was to drop and recreate the triggers....
2
2324
by: aallee83 | last post by:
i'm new in asp.net after develop my solution i copied it on the server where I want it to run but something cares... WHAT?!?! thank you in advance File or assembly name System, or one of its dependencies, was not found. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
3
1957
by: pinney.colton | last post by:
I would like to create a stored procedure which creates a temp table to store some XML. The # of fields of XML is dependent upon the contents of another table in the application, so the first part of my procedure identifies the # of fields necessary. That is working correctly. The second part of the procedure actually attempts to create the table. This is where my issue is. If I attempt to create the table as a non-temporary table,...
3
6883
by: comp_databases_ms-sqlserver | last post by:
This post is related to SQL server 2000 and SQL Server 2005 all editions. Many of my stored procedures create temporary tables in the code. I want to find a way to find the query plan for these procs Repro --*********************************** use pubs go CREATE PROCEDURE Test @percentage int
0
9926
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9776
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11096
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9552
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7953
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7108
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4597
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4194
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3223
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.