自己写的一个PL SQL 但是有点问题:
declare
v_id teacher.teacherid%type;
v_job_title teacher.title%type;
v_wage_origin teacher.wage%type;
v_wage_new teacher.wage%type;
Begin
v_id := &teacherid;
SELECT a.title into v_job_title FROM TEACHER A where v_id = teacherid;
Dbms_Output.put_line ('教授的原工资'||v_wage_origin);
Dbms_Output.put_line ('高工和副教授的原工资'||v_wage_origin);
case
when v_job_title ='教授' then
update teacher set wage = wage * 3 where teacher.title = '教授';
select teacher.wage into v_wage_new from teacher where teacher.title = '教授' where v_id = teacherid;
Dbms_Output.put_line('增长后的工资'|| v_wage_new );
when v_job_title = '高工' OR v_job_title = '副教授' then
update teacher set wage = wage * 2 where teacher.title in ('副教授','高工');
select teacher.wage into v_wage_new from teacher where teacher.title in ('副教授','高工');
DBMS_OUTput.put_line('增长后的工资'||v_wage_new);
end case;
end;error message: ORA-06550
PLS-00103:Encountered the symbol"_" when expecting one of the following:看样子 是这句v_id := &teacherid; 没有通过编译呀!
麻烦各位大虾 不吝赐教,小弟不胜感激!
declare
v_id teacher.teacherid%type;
v_job_title teacher.title%type;
v_wage_origin teacher.wage%type;
v_wage_new teacher.wage%type;
Begin
v_id := &teacherid;
SELECT a.title into v_job_title FROM TEACHER A where v_id = teacherid;
Dbms_Output.put_line ('教授的原工资'||v_wage_origin);
Dbms_Output.put_line ('高工和副教授的原工资'||v_wage_origin);
case
when v_job_title ='教授' then
update teacher set wage = wage * 3 where teacher.title = '教授';
select teacher.wage into v_wage_new from teacher where teacher.title = '教授' where v_id = teacherid;
Dbms_Output.put_line('增长后的工资'|| v_wage_new );
when v_job_title = '高工' OR v_job_title = '副教授' then
update teacher set wage = wage * 2 where teacher.title in ('副教授','高工');
select teacher.wage into v_wage_new from teacher where teacher.title in ('副教授','高工');
DBMS_OUTput.put_line('增长后的工资'||v_wage_new);
end case;
end;error message: ORA-06550
PLS-00103:Encountered the symbol"_" when expecting one of the following:看样子 是这句v_id := &teacherid; 没有通过编译呀!
麻烦各位大虾 不吝赐教,小弟不胜感激!
怎么两个where
select teacher.wage into v_wage_new from teacher where teacher.title = '教授' and v_id = teacherid;
两个where
select teacher.wage into v_wage_new from teacher where teacher.title = '教授' where v_id = teacherid; select teacher.wage into v_wage_new from teacher where teacher.title = '教授' and v_id = teacherid;