SQL——存储过程实例 调用带参数的过程(成绩输出)

create or replace procedure test_score(input in number,output out char) is

begin

       if input>=90 then
       begin
          output := 'A';
       end;
       end if;
       
       if input<90 then
       begin
          output := 'B';
       end;
       end if;
       
       if input<80 then
       begin
          output := 'C';
       end;
       end if;
       
        if input<70 then
       begin
          output := 'D';
       end;
       end if;
       
        if input<60 then
       begin
          output := 'E';
       end;
       end if;
       
       dbms_output.put_line('成绩为:'||output);
end test_score;

调用:

declare 
     sr number;--输入参数
     sc char;--输出参数
begin
     sr := 70;
     test(sr,sc);
end;

结果:

成绩为:C
逃避不一定躲得过,面对不一定最难过
原文地址:https://www.cnblogs.com/yangzhenlong/p/3542946.html