create or replace procedure findclass2(num in number) --创建或修改存储过程,存储过程名为findclass
as
totalClass number(1); --创建一个数字类型的变量,totalClass
begin
if num is not null then
select count(*) into totalClass from class; --把count计数出来的数量 通过into赋值给totalClass变量
DBMS_OUTPUT.put_line('num'||num); --数据库输出数量;
DBMS_OUTPUT.put_line('totalClass'||totalClass); --数据库输出数量;
if totalClass >=2 then
DBMS_OUTPUT.put_line('总班级数'||totalClass); --数据库输出数量;
if totalClass <=1 then
DBMS_OUTPUT.put_line('是小于'||totalClass); --数据库输出数量;
if num >0 then
DBMS_OUTPUT.put_line('num是'||num); --数据库输出数量;
else
DBMS_OUTPUT.put_line('都不执行'||num); --数据库输出数量;
end if;
end if;
end if;
end if;
end findclass2; --存储过程结束
create or replace procedure findclass(num in number) --创建或修改存储过程,存储过程名为findclass
as
totalClass number(1); --创建一个数字类型的变量,totalClass
begin --存储过程开始
if num is not null then
select count(*) into totalClass from class; --把count计数出来的数量 通过into赋值给totalClass变量
if totalClass >=2 then
DBMS_OUTPUT.put_line('总班级数'||totalClass); --数据库输出数量;
end if;
if num >5 then
DBMS_OUTPUT.put_line('num是'||num); --数据库输出数量;
end if;
if num >=0 then
DBMS_OUTPUT.put_line('num0是'||num); --数据库输出数量;
end if;
end if;
end findclass; --存储过程结束
来源:oschina
链接:https://my.oschina.net/u/4648981/blog/4704933