关于Alert table?

[复制链接]
查看11 | 回复8 | 2005-10-30 17:05:33 | 显示全部楼层 |阅读模式
Guidelines
? The column may or may not contain data.
? Using the ALTER TABLE statement, only one column can be dropped at a time.(此句是否有误,做过实验,Alter Table 可以同时Drop多列啊)
? The table must have at least one column remaining in it after it is altered.
? Once a column is dropped, it cannot be recovered.
007的原文如上:
此句是否有误,做过实验,Alter Table 可以同时Drop多列啊)
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
能把你的實驗過程貼出來嗎?
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
create table abc(a number,b number,c number)
alter table abc drop (a,b)
执行成功;
SQL> desc abc;
名称
是否为空? 类型
----------------------------------------- -------- --------
C
NUMBER
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
可能与数据库的版本有关
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
你的数据库版本多少?
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
最初由 dwilson 发布
[B]你的数据库版本多少? [/B]

SQL*Plus: Release 9.2.0.1.0 - Production on 星期四 6月 10 15:54:50 2004
Copyright (c) 1982, 2002, Oracle Corporation.All rights reserved.

连接到:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production

原文的版本为:
Oracle 9i student guide
40049GC10
Production 1.0
June 2001
D33051
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
其实这也很正常,在8i的studyGuide中还说不可以用alter table drop column这条语句呢:)
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
我在8.1.7.3的数据库试过可以同时删除多过,我翻看了一下001的书,里面这样说的“You can provide more than one column name separated by commans inside parentheses.”
回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
删除字段有两种语法:
alter table drop column column_name
or
alter table drop (column1,column2......)
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行