有以下几种情况
1. 查询的表的表名 是关键字
2. 查询的列名 是关键字
3. 表明是关键字的表,字段怎么通过代码去重命名知道的请帮帮忙,谢谢!
1. 查询的表的表名 是关键字
2. 查询的列名 是关键字
3. 表明是关键字的表,字段怎么通过代码去重命名知道的请帮帮忙,谢谢!
解决方案 »
- 初次尝试使用mysql的存储过程,取不出数据
- oracle效率低于mysql的原因
- 求最大值问题
- 高手们进来帮帮忙?
- (Oracle)判断表列名如果存在,执行删除。
- 可以“rm /u01/app/oracle/product/10.1.0/db_1/network/admin/*bak”么?
- win98+win2k双系统,如何在w2kserver上安装oracle8.1.7
- 在开一个帖子,问转归档的问题
- 怎么在数据库中查询前20条记录出来。希望是标准SQL。
- 我的存储过程错在哪里?请高手指点!
- oracle directory manager 目录管理器怎么配置!
- 请教 oracle11G 企业管理怎么打开
scott@YPCOST> create table sum(
2 id number,
3 count number);表已创建。scott@YPCOST> select * from sum;未选定行scott@YPCOST> insert into sum values(23,33);已创建 1 行。scott@YPCOST> insert into sum values(234,33);已创建 1 行。scott@YPCOST> select * from sum; ID COUNT
---------- ----------
23 33
234 33scott@YPCOST> select count from sum; COUNT
----------
33
33scott@YPCOST> select distinct count from sum; COUNT
----------
33
如果是表,删除,重建
如果是字段alter table tablename rename column tt to pp
最后还是修改表名和列名
scott@YPCOST> alter table sum rename to t_sum;表已更改。scott@YPCOST> alter table t_sum rename column count to c_count;表已更改。scott@YPCOST> select * from t_sum; ID C_COUNT
---------- ----------
23 33
234 33
--修改表名
alter table table1 rename to tab1;--修改列名
ALTER TABLE tab1 RENAME COLUMN u_id TO USERID--修改列大小
alter table table3 modify x varchar2(10);--修改列内容
update table3 set x='x2' where y = 'Y2'--删除记录
delete from table3 where x = 'X3'
SQL> create table table (a number);
create table table (a number)
ORA-00903: 表名无效
SQL>
Table created
SQL> drop table table;
drop table table
ORA-00903: 表名无效
SQL> drop table "TABLE";
Table dropped
SQL>
alter table sum rename to t_sum;
这样子不行,应为我的表是在另一个表空间下的
rename oldtb to newtb 他会报出找不到oldtb 表定义
但如果带上用户名
rename userNmae.oldtb to newtb 就有ORA-01765的错使用
alter userNmae。table sum rename to t_sum;是可以的