Topic
  • 2 replies
  • Latest Post - ‏2013-10-11T23:29:31Z by Steve_Chen
Conrad_Wolf
Conrad_Wolf
1 Post

Pinned topic Unable to Add Versioning (-766)

‏2013-06-11T19:47:29Z |

I am trying to create a new table taking advantage of the temporal features in DB2 v10 NFM for z/OS.  I have tried multiple variations, including examples verbatim from presentations and manuals.  Each time the result is the same:

   ALTER TABLE DSNA.POLICY                                                     
     ADD VERSIONING USE HISTORY TABLE DSNA.POLICY_HIST;                        
---------+---------+---------+---------+---------+---------+---------+---------+
DSNT408I SQLCODE = -766, ERROR:  THE OBJECT OF A STATEMENT IS A TABLE FOR      
         WHICH THE REQUESTED OPERATION IS NOT PERMITTED                        
 

I have verified everything listed for the error as possible causes.   The table is not incomplete, is not an auxiliary table, has no XML or security columns, and is not a clone.

CREATE TABLE DSNA.POLICY      (                            
    EMPL         VARCHAR(4) NOT NULL                       
   ,TYPE         VARCHAR(4)                                
   ,PLCY         VARCHAR(4) NOT NULL                       
   ,COPAY        VARCHAR(4)                                
   ,SYS_BEG      TIMESTAMP(12) NOT NULL                    
                 GENERATED ALWAYS AS ROW BEGIN             
   ,SYS_END      TIMESTAMP(12) NOT NULL                    
                 GENERATED ALWAYS AS ROW END               
   ,CRT_ID       TIMESTAMP(12) NOT NULL                    
                 GENERATED ALWAYS AS TRANSACTION START ID  
   ,PERIOD SYSTEM_TIME (SYS_BEG, SYS_END)                  
   ,EFF_BEG      DATE NOT NULL                             
   ,EFF_END      DATE NOT NULL                             
   ,PERIOD BUSINESS_TIME (EFF_BEG, EFF_END)                
   ,    PRIMARY KEY                                        
             (EMPL, PLCY, BUSINESS_TIME WITHOUT OVERLAPS)  
   )                                                       
    IN DBAAA000.TSAAA000                                   
    CCSID EBCDIC                                           
    ;                                                      
 

Thanks!

 

  • Jan-Eike
    Jan-Eike
    5 Posts

    Re: Unable to Add Versioning (-766)

    ‏2013-10-11T22:10:05Z  

    Conrad, in order to get to the root of your problem, could you please post the CREATE TABLE statement you used to define your history table (DSNA.POLICY_HIST)?

    Using your two statements and the following CREATE TABLE statement to create the history table, we did not encounter the error you did:

    CREATE TABLE DSNA.POLICY_HIST
      LIKE DSNA.POLICY;    

     

     

     

     

  • Steve_Chen
    Steve_Chen
    3 Posts

    Re: Unable to Add Versioning (-766)

    ‏2013-10-11T23:29:31Z  
    • Jan-Eike
    • ‏2013-10-11T22:10:05Z

    Conrad, in order to get to the root of your problem, could you please post the CREATE TABLE statement you used to define your history table (DSNA.POLICY_HIST)?

    Using your two statements and the following CREATE TABLE statement to create the history table, we did not encounter the error you did:

    CREATE TABLE DSNA.POLICY_HIST
      LIKE DSNA.POLICY;    

     

     

     

     

    Hi Conrad,  the -766 is most likely caused by not create the index for the primary key, which means an incomplete base table.