10PL_SQL过程之执行if语句
来源:互联网 发布:java 线程池 状态 编辑:程序博客网 时间:2024/05/22 17:43
declare
v_sal emp.sal%type;
begin
select sal into v_sal from emp
where empno = 7369;
if(v_sal<1200) then
dbms_output.put_line('low');
elsif(v_sal=1200) then
dbms_output.put_line('middle');
else
dbms_output.put_line('hige');
end if;
end;
注意elsif中没有else的e
declare
v_sal emp.sal%type;
begin
select sal into v_sal from emp
where empno = 7839;
if(v_sal<2500) then
v_sal := v_sal*2;
update emp set sal = v_sal where empno=7839;
commit;
elsif(v_sal=2500) then
dbms_output.put_line(v_sal);
else
v_sal := v_sal/2;
update emp set sal=v_sal where empno=7839;
commit;
end if;
end;
以上是PL_SQL执行select和update语句
v_sal emp.sal%type;
begin
select sal into v_sal from emp
where empno = 7369;
if(v_sal<1200) then
dbms_output.put_line('low');
elsif(v_sal=1200) then
dbms_output.put_line('middle');
else
dbms_output.put_line('hige');
end if;
end;
注意elsif中没有else的e
declare
v_sal emp.sal%type;
begin
select sal into v_sal from emp
where empno = 7839;
if(v_sal<2500) then
v_sal := v_sal*2;
update emp set sal = v_sal where empno=7839;
commit;
elsif(v_sal=2500) then
dbms_output.put_line(v_sal);
else
v_sal := v_sal/2;
update emp set sal=v_sal where empno=7839;
commit;
end if;
end;
以上是PL_SQL执行select和update语句
0 0
- 10PL_SQL过程之执行if语句
- 08PL_SQL过程之执行select语句
- 09PL_SQL过程之执行insert语句
- 21PL_SQL过程之函数
- 19PL_SQL过程之创建存储过程
- 01PL_SQL过程之输出HelloWorld
- 02PL_SQL过程之声明变量
- 03PL_SQL过程之捕获异常
- 06PL_SQL过程之复杂数据类型Table
- 11PL_SQL过程之创建表
- 12PL_SQl过程之三种循环
- 15PL_SQL过程之游标的使用
- 22PL_SQL过程之建立触发器
- 23PL_SQL过程之建立触发器
- mysql 存储过程之if语句
- 20PL_SQL过程之带参数的存储过程
- 07PL_SQL过程之复杂数据类型之Record
- Oracle PL_SQL语句总结
- static静态变量的理解
- MYSQL-----索引
- 创建"全世界最简单"の单例
- Java NIO系列教程(五) 通道之间的数据传输
- php.ini 文件配置详解
- 10PL_SQL过程之执行if语句
- MongoDB安装
- HashMap快速了解
- Socket网络编程及其通信原理
- 下拉刷新上拉加载开源控件---MaterialRefreshLayout开源控件
- Node.js 初试啼声
- hibernate——onetomany(双向)
- 机房收费(一)
- Uva1588 Kickdown