关闭

Oracle取余函数mod

标签: oraclemodtruncround
2276人阅读 评论(0) 收藏 举报
分类:

接下来将会和oracle存储过程打交道,一切都是新的,从基础的学起吧微笑

今天看几个函数:

1 mod 取余函数

SQL> declare
  2  tmp number;
  3  begin
  4  for tmp in 1..10 loop
  5  if mod(tmp, 2) = 0 then
  6  dbms_output.put_line(tmp||' can be mod by 2.');
  7  else
  8  dbms_output.put_line(tmp||' can not be mod by 2.');
  9  end if;
 10  end loop;
 11  exception
 12  when others then
 13  dbms_output.put_line('exception with :' || tmp);
 14  end;
 15  /
结果:

1 can not be mod by 2.
2can be mod by 2.
3 can not be mod by 2.
4can be mod by 2.
5 can not be mod by 2.
6can be mod by 2.
7 can not be mod by 2.
8can be mod by 2.
9 can not be mod by 2.
10can be mod by 2.
PL/SQL procedure successfully completed




0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:49027次
    • 积分:982
    • 等级:
    • 排名:千里之外
    • 原创:49篇
    • 转载:11篇
    • 译文:0篇
    • 评论:5条
    最新评论