我可以对同一名称空间中的不同对象使用所有带引号和不带引号的 UPPER_CASE 标识符吗?
Can I use all UPPER_CASE identifier with and without quote for different objects in the same namespace?
从Oracle doc第9个小点开始:
Nonquoted identifiers are not case sensitive.
Oracle interprets them as uppercase.
Quoted identifiers are case sensitive.
- part 1 -
By enclosing names in double quotation marks,
you can give the following names to different
objects in the same namespace:
employees
"employees"
"Employees"
"EMPLOYEES"
- part 2 -
Note that Oracle interprets the following names the same,
so they cannot be used for different objects in the same namespace:
employees
EMPLOYEES
"EMPLOYEES"
如果我可以将 employees
和 "EMPLOYEES"
赋予同一命名空间中的不同对象(来自第 1 部分),那么为什么第 2 部分说我不能使用 employees
和 "EMPLOYEES"
对于同一命名空间中的不同对象?
这不是自相矛盾吗?还是我理解错了?
如果您使用不带引号的名称 employees
,Oracle 会将其视为全部大写。事实上,employees
,不带引号,与任何字母 upper/lower 组合都会被视为 EMPLOYEES
。因此,如果您还添加 "EMPLOYEES"
,那么您只会添加相同的标识符。
为了更直观的解释,请考虑以下地图:
input | identifier
employees | EMPLOYEES
EMPLOYEES | EMPLOYEES
"EMPLOYEES" | EMPLOYEES
eMploYEeS | EMPLOYEES
"employees" | employees
我建议不要为需要用双引号转义的表、列等使用名称。除了区分大小写问题,您还应该避免使用保留的 SQL 关键字。
从Oracle doc第9个小点开始:
Nonquoted identifiers are not case sensitive. Oracle interprets them as uppercase. Quoted identifiers are case sensitive. - part 1 - By enclosing names in double quotation marks, you can give the following names to different objects in the same namespace: employees "employees" "Employees" "EMPLOYEES" - part 2 - Note that Oracle interprets the following names the same, so they cannot be used for different objects in the same namespace: employees EMPLOYEES "EMPLOYEES"
如果我可以将 employees
和 "EMPLOYEES"
赋予同一命名空间中的不同对象(来自第 1 部分),那么为什么第 2 部分说我不能使用 employees
和 "EMPLOYEES"
对于同一命名空间中的不同对象?
这不是自相矛盾吗?还是我理解错了?
如果您使用不带引号的名称 employees
,Oracle 会将其视为全部大写。事实上,employees
,不带引号,与任何字母 upper/lower 组合都会被视为 EMPLOYEES
。因此,如果您还添加 "EMPLOYEES"
,那么您只会添加相同的标识符。
为了更直观的解释,请考虑以下地图:
input | identifier
employees | EMPLOYEES
EMPLOYEES | EMPLOYEES
"EMPLOYEES" | EMPLOYEES
eMploYEeS | EMPLOYEES
"employees" | employees
我建议不要为需要用双引号转义的表、列等使用名称。除了区分大小写问题,您还应该避免使用保留的 SQL 关键字。