Naming Database Objects
Naming Database Objects
• Names must be from 1 to 30 bytes long with these
exceptions:
– Names of databases are limited to 8 bytes
– Names of database links can be as long as 128
bytes
• Nonquoted names cannot be Oracle reserved
words.
• Nonquoted names must begin with an alphabetic
character from your database character set.
Naming Database Objects
When you name an object in the database you have the option of enclosing names in double
quotation marks ("). If you do this then you can break several of the naming rules mentioned in the
slide. However this is not recommended, because if you name an object this way you must always
refer to it with the quotes around the name. For example, if you name a table "Local Temp" you
must do the following:
SQL> select * from "Local Temp";
TEMP_DATE LO_TEMP HI_TEMP
--------- ---------- ----------
01-DEC-03 30 41
If you mistype the case you will get:
SQL> select * from "local temp";
select * from "local temp"
*
ERROR at line 1:
ORA-00942: table or view does not exist
Nonquoted names are stored in uppercase and are not case sensitive. When a SQL statement is
processed, nonquoted names are converted to all uppercase.
Oracle Database 10g: Administration Workshop I 8-8
8-8 Copyright © 2004, Oracle. All rights reserved.
Naming Database Objects
• Nonquoted names can contain only
– Alphanumeric characters from your database
character set
– The underscore (_)
– Dollar sign ($)
– Pound sign (#)
• No two objects can have the same name within the
same namespace
Naming Database Objects (continued)
Nonquoted identifiers can contain only alphanumeric characters from your database character set
and the underscore (_), the dollar sign ($), and the pound sign (#). Database links can also contain
periods (.) and the “at” sign (@). You are strongly discouraged from using $ and # in nonquoted
identifiers.
Quoted identifiers can contain any characters and punctuations marks as well as spaces. However,
neither quoted nor nonquoted identifiers can contain double quotation marks.
Oracle Database 10g: Administration Workshop I 8-9
8-9 Copyright © 2004, Oracle. All rights reserved.
Schema Object Namespaces
The following have their
own namespace:
• Indexes
• Constraints
• Clusters
• Database triggers
• Private database
links
• Dimensions
The following are in the
same namespace:
• Tables
• Views
• Sequences
• Private synonyms
• Stand-alone
procedures
• Stand-alone stored
functions
• Packages
• Materialized views
• User-defined types
Schema Object Namespaces
The Oracle database uses namespaces to resolve schema object references. When you refer to an
object in a SQL statement, Oracle considers the context of the SQL statement and locates the
object in the appropriate namespace. After locating the object, Oracle performs the operation
specified by the statement on the object. If the named object cannot be found in the appropriate
namespace, then Oracle returns an error.
Because tables and views are in the same namespace, a table and a view in the same schema
cannot have the same name. However, tables and indexes are in different namespaces. Therefore, a
table and an index in the same schema can have the same name.
Each schema in the database has its own namespaces for the objects it contains. This means, for
example, that two tables in different schemas are in different namespaces and can have the same[@more@]
• Names must be from 1 to 30 bytes long with these
exceptions:
– Names of databases are limited to 8 bytes
– Names of database links can be as long as 128
bytes
• Nonquoted names cannot be Oracle reserved
words.
• Nonquoted names must begin with an alphabetic
character from your database character set.
Naming Database Objects
When you name an object in the database you have the option of enclosing names in double
quotation marks ("). If you do this then you can break several of the naming rules mentioned in the
slide. However this is not recommended, because if you name an object this way you must always
refer to it with the quotes around the name. For example, if you name a table "Local Temp" you
must do the following:
SQL> select * from "Local Temp";
TEMP_DATE LO_TEMP HI_TEMP
--------- ---------- ----------
01-DEC-03 30 41
If you mistype the case you will get:
SQL> select * from "local temp";
select * from "local temp"
*
ERROR at line 1:
ORA-00942: table or view does not exist
Nonquoted names are stored in uppercase and are not case sensitive. When a SQL statement is
processed, nonquoted names are converted to all uppercase.
Oracle Database 10g: Administration Workshop I 8-8
8-8 Copyright © 2004, Oracle. All rights reserved.
Naming Database Objects
• Nonquoted names can contain only
– Alphanumeric characters from your database
character set
– The underscore (_)
– Dollar sign ($)
– Pound sign (#)
• No two objects can have the same name within the
same namespace
Naming Database Objects (continued)
Nonquoted identifiers can contain only alphanumeric characters from your database character set
and the underscore (_), the dollar sign ($), and the pound sign (#). Database links can also contain
periods (.) and the “at” sign (@). You are strongly discouraged from using $ and # in nonquoted
identifiers.
Quoted identifiers can contain any characters and punctuations marks as well as spaces. However,
neither quoted nor nonquoted identifiers can contain double quotation marks.
Oracle Database 10g: Administration Workshop I 8-9
8-9 Copyright © 2004, Oracle. All rights reserved.
Schema Object Namespaces
The following have their
own namespace:
• Indexes
• Constraints
• Clusters
• Database triggers
• Private database
links
• Dimensions
The following are in the
same namespace:
• Tables
• Views
• Sequences
• Private synonyms
• Stand-alone
procedures
• Stand-alone stored
functions
• Packages
• Materialized views
• User-defined types
Schema Object Namespaces
The Oracle database uses namespaces to resolve schema object references. When you refer to an
object in a SQL statement, Oracle considers the context of the SQL statement and locates the
object in the appropriate namespace. After locating the object, Oracle performs the operation
specified by the statement on the object. If the named object cannot be found in the appropriate
namespace, then Oracle returns an error.
Because tables and views are in the same namespace, a table and a view in the same schema
cannot have the same name. However, tables and indexes are in different namespaces. Therefore, a
table and an index in the same schema can have the same name.
Each schema in the database has its own namespaces for the objects it contains. This means, for
example, that two tables in different schemas are in different namespaces and can have the same[@more@]
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/95530/viewspace-1023313/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ObjectsObject
- Talk about the naming of spring bean namesSpringBean
- 2.3.2 Application Common ObjectsAPPObject
- zend_objects_store_putObject
- 2.3.2.1 Creation of Application Common ObjectsAPPObject
- 2.1.3.3 Container Data Objects in a CDBAIObject
- 5-Overview-Understanding Kubernetes ObjectsViewObject
- 2.2.5 Overview of Common and Local Objects in a CDBViewObject
- Objects as Points 論文總結Object
- The database owner SID recorded in the master database differs from the database owner SID recorded in database 'DB_NAME'DatabaseAST
- 好用的java.util.Objects類JavaObject
- 淺談 Objective-C Associated ObjectsObject
- 2.3.2.3 Data-Linked Application Common ObjectsAPPObject
- 2.3.2.2 Metadata-Linked Application Common ObjectsAPPObject
- Oracle Database Cloud - Database as a Service Quick StartOracleDatabaseCloudUI
- Error querying database. XXXXXXXXXXXXX, No database selected。ErrorDatabase
- Convert a Physical Standby Database into a Snapshot Standby DatabaseDatabase
- 你要知道的 - Spread Operator for objects 技巧Object
- 你要知道的 – Spread Operator for objects 技巧Object
- jscalpel A small feature library that makes it easier to manipulate objectsJSObject
- ECE 4122/6122 OpenGL with OBJ files and Multiple ObjectsObject
- Database TimeoutDatabase
- Database OverallDatabase
- database no shardingDatabase
- [npm資源] naming-style,快速轉換各種命名風格NPM
- Android Room 之儲存 Objects 中的 ListAndroidOOMObject
- Objects.requireNonNull的意義是什麼ObjectUINull
- Oracle 12.2 使用Database Link優化Standby Database WorkloadOracleDatabase優化
- ORACLE database vaultOracleDatabase
- Relationship Database DesignDatabase
- 3.4 Quiescing a DatabaseUIDatabase
- idea--DatabaseIdeaDatabase
- Oracle clone databaseOracleDatabase
- database的connectDatabase
- Password is required when adding a database to AG group if the database has a master keyUIDatabaseAST
- ORA-16649: possible failover to another database prevents this database from beiAIDatabase
- 【AD報錯】GND contains Output Pin and Power Pin objectsAIObject
- Guide to Database as a Service (DBaaS)GUIIDEDatabase
- Oracle Database Scheduler整理OracleDatabase