n addition to renaming tables and indexes Oracle9i Release 2 allows the renaming of columns and constraints on tables. In this example once the the TEST1 table is created it is renamed along with it's columns, primary key constraint and the index that supports the primary key:
SQL> CREATE TABLE test1 (
2 col1 NUMBER(10) NOT NULL,
3 col2 VARCHAR2(50) NOT NULL);
Table created.
SQL> ALTER TABLE test1 ADD (
2 CONSTRAINT test1_pk PRIMARY KEY (col1));
Table altered.
SQL> DESC test1
Name Null? Type
-------------------- -------- --------------------
COL1 NOT NULL NUMBER(10)
COL2 NOT NULL VARCHAR2(50)
SQL> SELECT constraint_name
2 FROM user_constraints
3 WHERE table_name = 'TEST1'
4 AND constraint_type = 'P';
CONSTRAINT_NAME
------------------------------
TEST1_PK
1 row selected.
SQL> SELECT index_name, column_name
2 FROM user_ind_columns
3 WHERE table_name = 'TEST1';
INDEX_NAME COLUMN_NAME
-------------------- --------------------
TEST1_PK COL1
1 row selected.
SQL> -- Rename the table, columns, primary key
SQL> -- and supporting index.
SQL> ALTER TABLE test1 RENAME TO test;
Table altered.
SQL> ALTER TABLE test RENAME COLUMN col1 TO id;
Table altered.
SQL> ALTER TABLE test RENAME COLUMN col2 TO description;
Table altered.
SQL> ALTER TABLE test RENAME CONSTRAINT test1_pk TO test_pk;
Table altered.
SQL> ALTER INDEX test1_pk RENAME TO test_pk;
Index altered.
SQL> DESC test
Name Null? Type
-------------------- -------- --------------------
ID NOT NULL NUMBER(10)
DESCRIPTION NOT NULL VARCHAR2(50)
SQL> SELECT constraint_name
2 FROM user_constraints
3 WHERE table_name = 'TEST'
4 AND constraint_type = 'P';
CONSTRAINT_NAME
--------------------
TEST_PK
1 row selected.
SQL> SELECT index_name, column_name
2 FROM user_ind_columns
3 WHERE table_name = 'TEST';
INDEX_NAME COLUMN_NAME
-------------------- --------------------
TEST_PK ID
1 row selected.
分享到:
相关推荐
Renaming a workspace - _dsp and _dsw 对VC6工程文件重命名
Best fit columns and Auto-height rows In-place image and BLOB viewing Selected rows deletion Jump to specific record Built-in table Print Preview and Print Table Customization Table customization ...
NodeJS-重命名和删除目录
This program provides rapid Mp3 (ID3v1, ID3v2) and Ogg Vorbis tags editing and file renaming functions. Mass Tag editing is done using special variables and Regular Expressions. Undo and preview for ...
New Code Analysis and Refactoring Functions - smart object, column, and parameter renaming methods; smart code extraction methods; advanced code dependencies analysis Graphical analysis of ...
并且RRAT的写端口数量和提交宽度相同RENAMING的构造函数初始化参数,创建对象,计算各个对象的面积,并且得到整体的面积参数RENAMINGU::RENAM
Renaming and moving files in bulk 86 Spell checking and dictionary manipulation 89 Automating interactive input 90 Chapter 3: File In, File Out 95 Introduction 96 Generating files of any size 96 ...
Connected Lab 7: Deleting, Renaming, and Stashing Chapter 12: Understanding Remotes—Branches and Operations Connected Lab 8: Setting Up a GitHub Account and Cloning a Repository Chapter 13: ...
This utility will add, remove, or replace parts of the filename with ease and also supports renaming via file properties, MP3 tags, JPEG JFIF and EXIF tags, Video tags, and text files. Batch renaming ...
It comes with built-in hex inspection, batch renaming and screen capture tools. It is licensed as freeware for private, educational and non-profit uses. For other uses, it is licensed as commercial ...
Your source code gets so entangled through renaming, random code and string obfuscation, that no one can get your original code. Obfuscator Pro is the only Unity3d Obfuscator that considers ...
Renaming row and column names Getting ready How to do it... How it works... There's more... Creating and deleting columns Getting ready How to do it... How it works... There's more... See also 2. ...
PhotoWatermark Professional supports a combination of batch watermarking, cropping, converting, resizing, renaming and framing. Integrated how-to tips encourages you to start watermarking in no time!
Creating, renaming, moving, and deleting directories. Listing, reading, creating, editing, copying, and deleting files. Exactly how permissions work and how to decipher the most cryptic Linux ...
Obfuscator Pro features reachs from simple renaming: – Namespaces – Classes (also MonoBehaviour and NetworkBehaviour) – Fields – Propertys – Events – Methods Up to Method content obfuscation ...
文档: : 介绍 “简单重命名面板”是一种小型但功能强大的工具,可一次重命名更多对象。 该工具包括添加后缀,前缀,搜索和替换,根据对象类型添加后缀等基本功能。 随着时间的流逝,添加了诸如变量系统之类的更高级...
comprehensive help and demos.SQLMemTable provides the following services: - SQL support - Master / detail relationship - Creating, renaming, emptying, deleting and restructuring tables - Creating, ...
The V$ views that have been changed in Oracle Database 10g are identified by the symbol “(*)” after the name of each view (a change is the addition, renaming or deletion of columns). Also, there is...
Covers all aspects of managing user objects, including creating, renaming, moving, resetting passwords, unlocking, modifying the profile attributes, and locating users that have certain criteria (e.g....