Sie sind auf Seite 1von 3

Oracle naming standards tips

Oracle Tips by Burleson Consulting


This document describes a standard naming convention for Oracle schema objects including table
naming standards, index naming standards, constraint naming standards and column naming standards.
Oracle DBA's must pay careful attention to the structure and naming conventions and naming
standards ithin the database. All applications ill reside ithin the same schema oner and naming
conventions ill be used to identify table!index components"
Oracle Schema Naming Standards
The folloing standards ill be used in all schemas"
Schema objects # All non#table schema objects ill be prefixed by their type and all index
names ill begin ith idx, and all constraint names ill begin ith cons.
Referential Integrity conventions # All tables ill have full $%, including &' constraints, ('
constraints and chec) constraints. The default for foreign )ey constraints ill be *On Delete
$estrict*, unless otherise specified. This means that no parent record can be deleted if there
are corresponding child records.
Primary keys # Oracle +e,uences ill be used to generate uni,ue ro identifiers and all
se,uence numbers generally ill start at one and increment by one.
Check Constraints # -ists of valid values ill be used in all cases to restrict column values
and validity
Oracle table naming Standards
To simplify development, e ill follo these rules that allo the developer to ,uic)ly identify each
metadata object, ith complete descriptive names"
Table +tandards
All table names ill be plural .e.g. users vs. user/.
(ull table names ill be used henever possible.
%f a table name should exceed 01 characters, reduce the si2e of the table name in this
order"
(rom the left of the table name, remove voels from each ord in the table
name except for the first voel of each ord.
%f the table name is still greater than 01 characters, use standardi2ed shorthand
indicators. $ecord this standard for consistent use.
Oracle column naming Standards
3olumn 4aming +tandards
3olumn names should be spelled out henever possible.
%f a column name should exceed 01 characters, reduce the si2e of the column name in
this order"
(rom the left of the column name, remove voels from each ord in the table
name except for the first voel of each ord.
%f the column name is still greater than 01 characters, use standardi2ed shorthand
indicators. $ecord this standard for consistent use.
Oracle index naming Standards
%ndex +tandards
%ndex names should follo this standard"
%D56ttttt6nn
here
%D5 7 %ndex
tttt 7 Table name the index is built on
nn 7 4umeric value that ma)es each table index uni,ue.
%f an index name should exceed 01 characters, reduce the si2e of the index name in this
order"
(rom the left of the index name, remove voels from each ord in the table
name except for the first voel of each ord.
%f the index name is still greater than 01 characters, use standardi2ed shorthand
indicators. $ecord this standard for consistent use.
Oracle constraints naming Standards
3onstraint +tandards
&rimary )ey constraints ill follo this naming convention"
&'6nnnnn
8here nnnn 7 The table name that the index is built on.
9'6nnnnn_nn
8here nnnn 7 The table name that the index is built on.
nn 7 A number that ma)es the constraint uni,ue.
('6pppp_cccc_nn
8here pppp 7 The parent table name
cccc 7 The child parent table name
nn 7 A number that ma)es the constraint uni,ue
+ample names might include"
tables names # persons, islands, dsm6iv6codes
table column names # first6name, dsm6iv6code6description
constraint names # p)6ehd6food6establishment, f)6ehd6food6establishment61:
index names # idx6ssd6dsm61:
Oracle application naming Standards
!pplication Prefixes " All table!index!column!constraint names ill use standard prefixes. ;ach
application area ill be identified ith a three#character abbreviation, and this abbreviation ill be
used for the names of all tables, indexes and constraints. 8e ill not use system#generated constraint
or index names. (or example, assume e have these to application areas"
<eneral cross#area objects 7 <;4
+ocial +ervices Department 7 ++D
=ealth +ervices Department 7 =+D
Object names # To simplify development, e ill follo these standards that allo the developer to
,uic)ly identify each metadata object, ith complete descriptive names"
The application prefix ill be used in all metadata entries, including tables, indexes, constraints
and table columns.
The table name ill be included in all index, constraint and table column names.
The type of constraint ill be specified in all constraint names, using the abbreviations &', ('
and 3=;3'
Oracle table codes naming Standards
8henever possible, >codes? ill not be used, and the actual data values ill be stored in the tables.
(or example, e ill use full#values for all standardi2ed data columns"
alter table
ehd_food_establishment
add constraint
ehd_food_establishment_type_check
check
ehd_establishment_type in (
Restaurant,
Hotels,
Itinerant vendor,
Food shop,
Grocery store,
upermarket,
!ook shop,
bar
"#

Das könnte Ihnen auch gefallen