Quantcast
Channel: Doyensys Allappsdba Blog..
Viewing all articles
Browse latest Browse all 1640

Renaming constraints

$
0
0
    SQL> show user; 
    USER is "MAHE" 
     
    SQL> select dbms_metadata.get_ddl('TABLE', 'T1') from dual; 
     
    DBMS_METADATA.GET_DDL('TABLE','T1') 
    --------------------------------------------------------- 
     
      CREATE TABLE "MAHE"."T1" 
       ( "A" NUMBER 
       ) SEGMENT CREATION IMMEDIATE 
     
     
    SQL> alter table T1 add constraint t1_mypk primary key (a); 
     
    Table altered. 
     
    SQL> select dbms_metadata.get_ddl('TABLE', 'T1') from dual; 
     
    DBMS_METADATA.GET_DDL('TABLE','T1') 
    --------------------------------------------------------- 
     
      CREATE TABLE "MAHE"."T1" 
       ( "A" NUMBER, 
      CONSTRAINT "T1_MYPK" PRIMARY KEY ("A") 
     
     
    SQL> alter table T1 rename constraint T1_MYPK to T1_PK;  
     
    Table altered. 
     
    SQL> select dbms_metadata.get_ddl('TABLE', 'T1') from dual; 
     
    DBMS_METADATA.GET_DDL('TABLE','T1') 
    --------------------------------------------------------- 
     
      CREATE TABLE "MAHE"."T1" 
       ( "A" NUMBER, 
      CONSTRAINT "T1_PK" PRIMARY KEY ("A") 
     
     
      DONE****

Viewing all articles
Browse latest Browse all 1640

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>