At 10:29 PM 10/11/2004 -0400, Bernie Lis wrote:
How can I unload all the views in one database to insert into another database (same name)?
Bernie,
Ask and you shall receive!
Here's one way to achieve your goal:
-- Start here ... -- UnloadViews.RMD SET VAR vViewName TEXT = NULL SET VAR vViewFileName TEXT = NULL
DECLARE c1 CURSOR FOR SELECT SYS_TABLE_NAME + FROM SYS_TABLES + WHERE SYS_TABLE_TYPE = 'VIEW' ORDER BY SYS_TABLE_NAME OPEN c1 FETCH c1 INTO + vViewName INDIC ivViewName WHILE SQLCODE <> 100 THEN SET VAR vViewFileName = (.vViewName+'.VIE') OUTP &vViewFileName UNLOAD STRUCTURE FOR .vViewName OUTP SCREEN FETCH c1 INTO + vViewName INDIC ivViewName ENDWHILE DROP CURSOR c1 CLEAR VAR iv%, vViewName, vViewFileName RETURN -- End here ...
DIR *.VIE will give you the list of all unloaded views and the structure!
Then all you need to do is to copy all *.VIE files in the same directory as the other database with the same name, and simply INPUT each file one at a time.
Enjoy and make sure to have fun!
Very Best R:egards,
Razzak.

