您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

Oracle中两表之间值互相插入和表自身插入值

2025/9/8 11:03:14发布16次查看
有两张表student和otherstudent,表信息如下 sqlgt; desc studentname type nullable default comments ---- ---------
有两张表student和otherstudent,表信息如下
sql> desc student
name type         nullable default comments
---- ------------ -------- ------- --------
num  number                                
name varchar2(20)                          
age  number       y
sql> desc otherstudent
name type         nullable default comments
---- ------------ -------- ------- --------
num  varchar2(50)                          
name varchar2(50)
现在做以下几个实验
实验一
现在student中有数据,,我想把里面的数据插入otherstudent里面。
insert into otherstudent(num,name) select num,name from student
两表插入的字段类型或长度并补一致仍然可以插入,说明只要被插入的表可以接收,类型不一致或长度不一致不影响。
实验二
otherstudent有了数据了,可以将该表的数据再插入本表
insert into otherstudent select * from otherstudent
实验三
语句insert into otherstudent select * from student。报错“值过多”。
语句insert into student select * from student otherstudent。报错“没有足够的值”。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product