`

存储过程基础语法

end 
阅读更多
  create or replace procedure 存储过程名(input in type,...,output out type,...)

as

v1 type(值范围);
cursor test_cur is select p.level_name from A
....
Begin

    Select count(*) into v1 from A where a.列=input;

    If (v1>1) then
       Dbms_output。Put_line(v1);

    Elsif (true) then

       Dbms_output.Put_line(‘ok');

    Else

       Raise 异常名(NO_DATA_FOUND);

    End if;

Exception

    When others then

       Rollback;

End;

注意:

1、  存储过程中参数是不带取值范围,in 传入,out  输出,默认是in;

2、  变量要有带取值范围,且后面接分号;

3、  用select 。。。into。。。给变量赋值
4、dbms_output.put_line()输出语句

5、  在代码中抛异常用 raise+异常名
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics