本人是Oracle 的热捧者,以下的相关内容主要是我个人对于Oracle存储过程的一个总结,其中包括储存过程的创建,以及变量赋值的实际应用,以下就是文章的具体内容的描述,希望你会有所收获。
1、创建存储过程
create or replace procedure test
(var_name_1 in type,var_name_2 out type) as
- 1.
- 2.
声明变量(变量名 变量类型)
begin
- 1.
Oracle存储过程的执行体
end test;
- 1.
打印出输入的时间信息
E.g:
create or replace procedure test(workDate in Date) is
begin
dbms_output.putline('The input date is:'
||to_date(workDate,'yyyy-mm-dd'));
end test;
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
2、变量赋值
变量名 := 值;
E.g:
create or replace procedure test(workDate in Date) is
x number(4,2);
begin
x := 1;
end test;
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
3、判断语句
if 比较式 then begin end; end if;
E.g
create or replace procedure test(x in number) is
begin
if x >0 then
begin
x := 0 - x;
end;
end if;
if x = 0 then
begin
x: = 1;
end;
end if;
end test;
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
上述的相关内容就是对Oracle存储过程总结的描述,希望会给你带来一些帮助在此方面。
【编辑推荐】