oracle 1
来源:互联网 发布:乐视2用不了移动数据 编辑:程序博客网 时间:2024/06/06 09:18
觉得应该好好总结一下,ORACLE之PL/SQL学习
begin
if ... then
...
elsif ...then
...
end if;
end;
实例:
- DECLARE
- a number;
- b varchar2(10);
- begin
- a:=2;
- if a=1 then
- b:='a';
- elsif a=2 then
- b:='b';
- else
- b:='c';
- end if;
- DBMS_OUTPUT.PUT_LINE('b is'||b);
- end;
- /
有关case when
case
when.. then...
when.. then...
end case
实例
- DECLARE
- a number;
- b varchar2(10);
- begin
- a:=2;
- case
- when a=1 then b:='a';
- when a=2 then b:='b';
- when a=3 then b:='c';
- else
- b:='others';
- end case;
- DBMS_OUTPUT.PUT_LINE('b is'||b);
- end;
- /
循环语句
LOOP
...
END LOOP
WHILE expression LOOP
...
END LOOP
FOR counter in[REVERSE] start_value..end_value LOOP
...
END LOOP;
实例(用第一种方式)
- declare
- x number;
- begin
- x:=0;
- loop
- x:=x+1;
- if x>=3 then
- exit;
- end if;
- dbms_output.put_line('内:x='||x);
- end loop;
- dbms_output.put_line('外:x='||x);
- end;
- /
用exit when方式
- declare
- x number;
- begin
- x:=0;
- loop
- x:=x+1;
- exit when x>=3;
- dbms_output.put_line('内:x='||x);
- end loop;
- dbms_output.put_line('外:x='||x);
- end;
- /
用第三种方式,注意这是reverse的俄,如果是1 to 5,就不加reverse
- begin
- for i in reverse 1..5 loop
- dbms_output.put_line('i='||i);
- end loop;
- dbms_output.put_line('end of for loop');
- end;
- /
- 【Oracle】Oracle基础知识1
- Oracle 1
- oracle-1
- oracle 1
- oracle 1
- ORACLE 1
- oracle-1
- oracle--1
- Oracle-1
- Oracle-1
- Oracle-1
- Oracle – Oracle SQL(1)
- Oracle学习1:Oracle简介
- ORACLE学习笔记(1)--ORACLE安装
- Oracle Report開發(1)--Oracle Report Builder
- oracle学习笔记1--oracle体系结构
- Oracle Tips 1 (Oracle Architectural Components)
- [oracle] MySql 与 Oracle 的迁移 1
- 存储过程实例
- 如何为外贸网站选择一个安全稳定的网站空间?
- 新人
- 从进程中巧妙判断出病毒与木马
- for /while 循环
- oracle 1
- oracle 2
- oracle 3
- 使用RealViewMDK时常见的问题(1)
- VS2008 direct9.0 开发平台搭建————第一个D3D程序
- 学习
- 从搜索的角度看互联网
- Android tabhost
- Android wifi锁