创建函数、存储过程、锁表信息查看

函数:

CREATE OR REPLACE   
FUNCTION testFunc (num1 IN NUMBER, num2 IN NUMBER)  
RETURN NUMBER  
AS/IS  
    num3 number;  
    num4 number;  
    num5 number;  
BEGIN  
    num3 := num1 + num2;  
    num4 := num1 * num2;  
    num5 := num3 * num4;  
    RETURN num5;  
END;  

--执行   select explainHello(1,2) from dual;

存储过程:

--创建存储过程
create or replace procedure proc_test(
num1 in Integer,
num2 in Integer,
type in Integer,
result out Integer
)
as 
begin 
       if type=1 then
          result := num1 + num2;
       else if type=2 then
         result:=num1 - num2;
       else if type=3 then
         result:=num1 * num2;
       else if type=4 then
         result:=num1/num2;
       else 
         dbms_output.put_line('其他处理'); 
       end if;
end;

查询锁表与解除方法

SELECT object_name, machine, s.sid, s.serial# 
FROM gv$locked_object l, dba_objects o, gv$session s 
WHERE l.object_id = o.object_id 
AND l.session_id = s.sid; 

alter system kill session '24,111'; 
这是释放锁的语句
(其中24,111分别是上面查询出的sid,serial#)

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值