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