oracle 数据库存储过程怎么用传入参数作为查询条件

2025-03-22 22:23:05
推荐回答(2个)
回答1:

一、在oracle中定义一个数组类型(TYPE)
代码如下:
createorreplacetype msg_array astableofnumber;
意思是创建一个名称为msg_array,存放类型为整型的数组类型
二、在oracle中定义一个存储过程
代码如下:
createorreplaceprocedure modifyage(m_array in msg_array)
as
begin
for i in1..m_array.count loop
update users set age=age+1where id=m_array(i);
endloop;
commit;
exception
whenothersthen
rollback;
end modifyage;
创建一个存储过程,传入的参数是上面定义的msg_array类型,操作内容为循环传入的数组,对表的age字段做加1操作。

回答2:

desc ALL_PROCEDURES