insert into student as
select t.s_id, t.s_name, t.s_sex, t.c_id * 2 c_id
from student t
where t.c_id = '5';
------解决方案-------------------- insert into
student values(s_id, s_name, s_sex, c_id)
select s_id,s_name,s_sex,10
from student
where c_id=5 ------解决方案-------------------- 不过我估计你 要的 应该是下面这个sql;
insert into student
select t.s_id,
t.s_name,
t.s_sex,
case
when count(t.c_id) over(partition by c_id) = 1 then
t.c_id
else
t.c_id * count(t.c_id) over(partition by c_id)
end c_id
from student t
where t.c_id = '5';
------解决方案--------------------
你这个10 不就是在原来5的基础上+传进来的5吗??
------解决方案--------------------
insert into student values(s_id, s_name, s_sex, c_id)
select 5 s_id ,s_name,s_sex,10 c_id from student where c_id=5
s_id是主键,执行为什么就不行了了?plsql中报ORA-00933:SQL command not properly ended
基本语法都搞不会?
insert into student
(s_id, s_name, s_sex, c_id)
select 5 s_id, s_name, s_sex, 10 c_id from student where c_id = 5