根据输入的编号获取某学员的成绩--if
declare
score user_tb1.score%type;
begin
select score int score from user_tb1 where id='&id';
if score>90 then
dbms_output.put_line('优秀');
...
...
end if;
end;
请各位翻译一下,就是给在后面添一下注释,刚学,看不懂

解决方案 »

  1.   


    declare
    score user_tb1.score%type;--socre为变量,不过一般此处变量用v_开头比较规范,类型与表user_tb1.score列的类型相同
    begin
    select score int score from user_tb1 where id='&id';--不是int是into,此处给变量score赋值,取自表user_tb1中id为你给替换变量&id的值记录对应的score
    if score>90 then--当结果大于90,输出优秀,显示在屏幕上
    dbms_output.put_line('优秀');--调用dbms_output函数显示结果,需set serveroutput on先
    ...
    ...
    end if;
    end;
      

  2.   

    declare
    i number(4):=1;
    begin
    while i<=10 loop
    dbms_output_put_line('while loop size='||i);
    i:=i+1;
    end loop;
    end;
    麻烦再给注释一下