复制代码 代码如下:
SQL> DROP TABLE k;
Table dropped
-- 建立表K,字段名为UID(oracle关键字)
SQL> CREATE TABLE k(UID INT);
CREATE TABLE k(UID INT)
ORA-00904: : invalid IDENTIFIER
-- 字段名加""表创建成功
SQL> CREATE TABLE k("UID" INT);
Table created
--插入一些数据
SQL> INSERT INTO k VALUES(1);
1 row inserted
SQL> INSERT INTO k VALUES(2);
1 row inserted
SQL> INSERT INTO k VALUES(3);
1 row inserted
-- 查询时加不加""都正常(似乎不太符合规范)
SQL> SELECT UID FROM k;
UID
----------
5
5
5
SQL> SELECT "UID" FROM k;
UID
---------------------------------------
1
2
3
-- update时必须加上""
SQL> UPDATE k SET UID=5 WHERE UID=3;
UPDATE k SET UID=5 WHERE UID=3
ORA-01747: invalid user.table.column, table.column, or column specification
SQL> UPDATE k SET "UID"=5 WHERE "UID"=3;
新闻热点
疑难解答