oracle if=,oracle if 语句 一种是多种判断 if 一种 是嵌套if

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值