
alter table your_table add (column col_type clumn col_type )
your_table :表名
column /column 字段名
col_type /col_type 字段类型
建议用过程实现添加字段 屏蔽掉字段已经存在所造成的错误 另外 一次添加一个字段会更好一些
declare
vstr_sql varchar ( ):= alter table your_table add (column col_type clumn col_type )
begin
execute immediate vstr_sql
end
/
select column_name data_type from ALL_TAB_COLUMNS where TABLE_NAME= XX
可以查XX表列名
你可以先查出所有的列 判断是否已有 没有就添加
lishixinzhi/Article/program/Oracle/201311/16876
工具/材料:电脑,oracle数据库表
1.例test表中有如下数据。
2.插入一条id为6,name为杨七的数据。insert into testvalues (6,'杨七')commit。
3.向表中复制一条目前表中id为1的数据,可用如下语句:insert into test select * from test where id=1commit在执行insert语句后,必须提交,即commit,否则不成功。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)