Oracle存储过程

 Oracle存储过程功能强大,他主要的作用有以下几点:

1.可以批量执行sql语句,提供内置的事务支持,同时能够提高数据库操作的效率。

2.客户端程序依据存储过程名来调用,提供程序的可移植性。

3.提供复杂的SQL语句逻辑支持。

语法结构包括过程声明,执行过程部分,存储过程异常

1)不带参数:

Create or replace procedure NoparProcedureName

is

begin

delete from tablename  a where a.id='';

delete from tablename b where b.id=''; 

exception

end;

2)带参数:

Create or replace procedure ParProcedureName(key_id in char)

is

begin

delete from tablename  a where a.id=key_id;

update tablename b set b.name='测试' where b.id=key_id; 

exception

end;

3)带参数含赋值

Create or replace procedure MyProcedureName(key_id in char,isal out varchar)

is icount number ;

begin

select count(*into icount from emp where sal>isal ;

if icount==1 then ...

esle

...

end if ;

 

end

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值