DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: Generate Create table script from view

Threaded View

  1. #4
    Join Date
    Jul 2002
    Location
    Lake Worth, FL
    Posts
    1,492

    Cool


    If you create the database link, and supposing the view names are like "{table_name}_VW", then you can use a script like this to report discrepancies:

    Code:
    Select S.Table_Name, S.Column_Name, S.Column_Id
         , S.Data_Length||'<>'||T.Data_Length Data_Length
         , S.Data_Precision||'<>'||T.Data_Precision Data_Precision
         , S.Data_Scale||'<>'||T.Data_Scale Data_Scale
         , S.Nullable||'<>'||T.Nullable Nullable
      From All_Tab_Columns S, All_Tab_Coluns@Target T
    Where T.Owner 		= S.Owner  
      And T.Table_Name	= Substr(S.Table_Name,1,Instr(S.Table_Name,'_Vw')-1)
      And T.Column_Id	= S.Column_Id  
      And T.Column_Name	= S.Column_Name  
      And ( 
           S.Data_Length	!= T.Data_Length  
        Or S.Data_Precision	!= T.Data_Precision  
        Or S.Data_Scale 	!= T.Data_Scale  
        Or S.Nullable 	!= T.Nullable );


    Last edited by LKBrwn_DBA; 10-13-2005 at 11:15 AM.
    "The person who says it cannot be done should not interrupt the person doing it." --Chinese Proverb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width