if循环语句:

1:语法:

IF <布尔表达式> THEN

PL/SQL 和 SQL语句
END IF;
--或
IF <布尔表达式> THEN
PL/SQL 和 SQL语句
ELSIF
其它语句
END IF;

2:实例:

--查询姓名是Scott的工资。
declare
V_ename emp.ename%type :='SCOTT';
V_sal emp.sal%type;
V_comment varchar2(60);

begin
select sal into V_sal from emp where ename=V_ename;
if V_sal<1500 then
V_comment :='Fairly less';
elsif V_sal<3000 then
V_comment :='A little more';
else
V_comment :='Lots of money';
end if;
dbms_output.put_line(V_sal);
dbms_output.put_line(V_comment);
end;

相关文章:

  • 2021-09-06
  • 2021-06-28
  • 2022-12-23
  • 2021-11-29
  • 2021-12-28
  • 2022-12-23
  • 2022-12-23
  • 2021-09-12
猜你喜欢
  • 2022-12-23
  • 2021-09-17
  • 2021-11-24
  • 2021-06-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案