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.
分享到:
相关推荐
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 ...
console.error('Error renaming directory:', err); } else { console.log('Directory renamed successfully!'); } }); ``` 如果新名称已经存在,`fs.rename()`会覆盖原有的文件或目录,因此在实际应用中需要...
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 ...
在Microsoft Visual C++ 6.0 (VC6)开发环境中,工作区文件(.dsw)和项目文件(.dsp)是两个非常重要的组件。它们分别管理着整个工程的配置和单个项目的设置。当你创建一个新的工程时,VC6会自动生成一个.dsw工作区...
1. RENAMING 类声明 RENAMING 类是核心组件中的一个重要部分,它实现了重命名单元的功能。这个类包含了七个 ArrayST 对象,其中 iFRAT 和 fFRAT 分别代表整数和浮点数的前端寄存器分配表(Front RAT),它们用于在...
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 ...
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 ...
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 ...
- **Database Concepts:** Explanation of database concepts, including tables, rows, columns, and relationships. - **SQL Basics:** Overview of SQL syntax, including SELECT, INSERT, UPDATE, DELETE, and ...
RENAMING中的`dep_resource_conflict_check`解析主要涉及到处理器内部的一种资源管理机制,用于处理在乱序执行或按序执行的处理器中可能出现的资源冲突。这个机制通过类`dep_resource_conflict_check`来实现,它关注...
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: ...
- **4.3 Hiding and renaming global symbols 隐藏和重命名全局符号**:讨论了如何隐藏某些符号,使其不被外部程序访问,以及如何重命名全局符号。 - **4.4 Using $Super$ and $Sub$ to override symbol definitions...
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. ...
At this point, you can perform operations like renaming datafiles and redolog files, which are not available once the database is fully open. - **Datafiles and Redolog Files Are Made Available to ...
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!
Obfuscator Pro features reachs from simple renaming: – Namespaces – Classes (also MonoBehaviour and NetworkBehaviour) – Fields – Propertys – Events – Methods Up to Method content obfuscation ...