Home > Net >  DROP VIEW without drop dependent views
DROP VIEW without drop dependent views

Time:09-28

I need to change a VIEW, so I have to DROP and CREATE it.

DB2 manual say "Any views that are dependent on the view being dropped are made inoperative."

I try but dependent view are dropped, not made inoperative.

Is there a way to bypass the dependent views drop?

CodePudding user response:

sysibm.views provides access to the view_definition

SELECT char(table_SCHEMA,10) libname,       
       char(table_NAME,30) view_name,       
       length(a.view_definition) lgth ,     
       cast(substr(a.view_definition,1,500) 
             as varchar(5000)) view_defn    
FROM   sysibm.views a                       

you should be able to first retrieve the definition of the dependent views. Then drop and recreate the view. And finally, create the dependent views from the saved view_definition.

  • Related