oracle 中运行存储过程作为返回值

2025-05-20 21:45:54
推荐回答(3个)
回答1:

oracle可以使用out型参数返回值,例如:

  

-- 查询某商品编号是否存在,返回查询状态
create or replace procedure proc_getGood
(
    param_shopId number,--商品编号
    param_flag out number--查询状态 0不存在
)
as
    declare v_count  number(1);
begin
    select count(*) into v_count  from tb_goods where shopid=param_shopid;
    
    if v_count =0 then
        param_flag:=0;
    else
        param_flag:=1;
    end if;

end;

回答2:

第一个问题:
oracle没有inser into 表 存储过程的语句格式,所以这个需要你根据实际要求换种思路做吧。
第二个问题:
sqlserver:'a'+char(10)+'b'
oracle:'a' || chr(10) || 'b' sqlserver中的char函数在oracle中是chr,参数和返回值是一样的。

回答3:

说清楚