Solved

db2 sql: Is possible change view that is called from another view, without delete the second one?

Posted on 2011-03-10
6
631 Views
Last Modified: 2012-06-21
DB2 sql:
Is it possible change a viewA that is called from another viewB, without delete the second one?
At the moment I have a viewA,
then a viewB that uses viewA.
I want to change viewA without drop it, because if I drop it,  viewB has be dropped too.
And I would like only modify viewA,
something like CHGPF command, in DDS structure...
0
Comment
Question by:bobdylan75
6 Comments
 
LVL 35

Accepted Solution

by:
Gary Patterson earned 167 total points
ID: 35094449
You need to drop the dependent objects, drop the view, re-create the altered view, and recreate any dependent objects.

So you know that you can retrieve the SQL ddl for the views involved using Navigator?   As a result recreating a dependent view only takes a few seconds, since you can retrieve the ddl to a file, drop the view, and then just re-run the saved SQL ddl. To restore the view.

0
 
LVL 37

Assisted Solution

by:momi_sabag
momi_sabag earned 167 total points
ID: 35094452
you can try to use the alter statement but i'm not sure it will work

try to alter viewa, and then re-generate viewb
0
 

Author Comment

by:bobdylan75
ID: 35094970
Yes I know..
I can also use DSPFD(LIB/VIEW) to retreive the sql code..
0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 

Author Comment

by:bobdylan75
ID: 35094976
So,
isn't there a different way?
0
 
LVL 18

Assisted Solution

by:daveslash
daveslash earned 166 total points
ID: 35096910

Hi bob,

I don't believe there is any other way. To my knowledge, "DB2 for i" does not have an ALTER VIEW statement. I even checked the documentation for V7R1, and it doesn't seem to exist there, either.

You'll have to retrieve the source of the view and recreate them manually.

HTH,
DaveSlash
0
 

Author Comment

by:bobdylan75
ID: 35096961
ok thank you everybody..
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question