472,362 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,362 software developers and data experts.

How to display dependencies for a view (source tables)

For db2 UDB I need to get dependency information for views.

What I'm looking for is the tables that have the source information for
the view.
i.e. : if the following view was defined in my database:
create view my_view as
select parent_id, son_id
from parent A, son B
where A.parent_id = B.parent_id
Is there any way that starting from my_view I can get the information
that parent and son are the tables that are actually the source tables
for the data that make up the view?
Another *different* question is how can I get the code that generates
the view (the select query above). But please note that this will *not*

solve my problem, I am working in a programmatic environment so I can't

"parse" a bunch of SQL to find out which ones are the source tables.

What I need is a result set that contains the table names of 'parent'
and 'son' (referring to the example). Ideally, something like:
SQL> [magic query involving my_view];
TABLE
------
parent
son

What is the magic query?

Any help would be greatly appreciated. :)

S

Nov 12 '05 #1
3 11879
Seba wrote:
For db2 UDB I need to get dependency information for views.

What I'm looking for is the tables that have the source information for
the view.
i.e. : if the following view was defined in my database:

Take a look at SYSCAT.VIEWS for the view text.
Check out SYSCAT.VIEWDEP for immediate objects the view depends on.
To find all the objects recursively check out the DB2LK_DEP_OF()
function in SYSCAT.ROUTINES. That one looks up. You can use it as a
template to get one that looks down.

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #2
Ian
Seba wrote:
For db2 UDB I need to get dependency information for views.

What I'm looking for is the tables that have the source information for
the view.
i.e. : if the following view was defined in my database:
create view my_view as
select parent_id, son_id
from parent A, son B
where A.parent_id = B.parent_id
Is there any way that starting from my_view I can get the information
that parent and son are the tables that are actually the source tables
for the data that make up the view?
Another *different* question is how can I get the code that generates
the view (the select query above). But please note that this will *not*

solve my problem, I am working in a programmatic environment so I can't

"parse" a bunch of SQL to find out which ones are the source tables.

What I need is a result set that contains the table names of 'parent'
and 'son' (referring to the example). Ideally, something like:
SQL> [magic query involving my_view];
TABLE
------
parent
son

What is the magic query?


See SYSCAT.TABDEP

select bschema, bname
from syscat.tabdep
where tabschema = ? and tabname = ?

Nov 12 '05 #3

Seba wrote:
For db2 UDB I need to get dependency information for views.

What I'm looking for is the tables that have the source information for the view.
i.e. : if the following view was defined in my database:
create view my_view as
select parent_id, son_id
from parent A, son B
where A.parent_id = B.parent_id
Is there any way that starting from my_view I can get the information
that parent and son are the tables that are actually the source tables for the data that make up the view?
Another *different* question is how can I get the code that generates
the view (the select query above). But please note that this will *not*
solve my problem, I am working in a programmatic environment so I can't
"parse" a bunch of SQL to find out which ones are the source tables.

What I need is a result set that contains the table names of 'parent'
and 'son' (referring to the example). Ideally, something like:
SQL> [magic query involving my_view];
TABLE
------
parent
son

What is the magic query?

Any help would be greatly appreciated. :)

S


if you're going to be spending a significant amount of time in
databases (DB2 or otherwise), i advise getting AQT (www.querytool.com).

if provides that specifically and a boat load of other info that
is more or less a pain to get manually.

btdb

Nov 12 '05 #4

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

Similar topics

5
by: John Taylor-Johnston | last post by:
This will give me the source of the current page. <a herf="javascript:document.location = 'view-source:'+document.location">testpage.htm</a> I want to display the source of another page, using...
5
by: Pete Wason | last post by:
Hiall! I have a demo viewer page for javascript stuff that has three buttons "DEMO" "HTML" and "JSCR", and an IFRAME called 'viewer'. Initially, the IFRAME gets loaded with the actual demo...
4
by: k | last post by:
A programming the internet class has been asked if it is possible to 'grey out' the View Source option in a browser menu. Multiple respondents think it is possible but not sure how to do it. I have...
8
by: Nancy | last post by:
Hi, Guys, I don't know why I can't view some webpages source code by click "View->Source" menu of Browser. These webpage source code can be viewed in same way by using other computers. My OS is...
6
by: shr | last post by:
Is there any way by which I can display the source of a html page using the 'view:source' command, in an iframe?? I tried using this viewer.location = "view-source:" + viewer.location.href; where...
29
by: lori3laz | last post by:
How do you disable the right click>view source option on web pages so people can't view your coding and copy it? What's the html I need to include in my website to utilize this feature? Thank...
24
by: Roman | last post by:
Hello to everybody, I have some question concerning blocking view source from main menu of IE or MF. I am able to block right click with <body oncontextmenu="return false"> but still missing from...
8
by: devain | last post by:
Question about positioning in view source. What I am trying to accomplish is this: 1. I have content that is revelant to the my site that is currently being displayed to the user at the bottom...
1
by: khadar siddi | last post by:
I have tested this in the following two browsers. 1.Internet Exolorer 2.Mozilla FireFox In Internet Explorer: ------------------------ When I right click and see the view source...the html...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
0
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

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.