您当前的位置: 首页 >  oracle

wespten

暂无认证

  • 0浏览

    0关注

    899博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Oracle流程控制语句

wespten 发布时间:2018-08-19 07:02:54 ,浏览量:0

if...else

set serverout on;
declare n number:=1;
        v varchar2(20):='world';
begin
   dbms_output.put_line('hello'||n||v);
end;


set serverout on;
declare emp_count number;
begin
  select count(*) into emp_count from emp where sal>=3000;
  if emp_count>0 then
    dbms_output.put_line('有'||emp_count||'个员工的基本薪资大于等于3000');
  else
    dbms_output.put_line('没有员工的基本薪资大于等于3000'); 
  end if;
end;


set serverout on;
declare emp_count number;
begin
  select count(*) into emp_count from emp where sal>=3000;
  if emp_count=1 then
    dbms_output.put_line('有1个员工的基本薪资大于等于3000');
  else if emp_count>1 then
    dbms_output.put_line('有超过1个员工的基本薪资大于等于3000');
  else
    dbms_output.put_line('没有员工的基本薪资大于等于3000'); 
  end if;
  end if;
end;

case...when

set serverout on;
declare emp_count number;
begin
  se
关注
打赏
1665965058
查看更多评论
立即登录/注册

微信扫码登录

0.0416s