如何在Oracle存储过程中给出退货值 [英] How to give Return out put value in Oracle Stored Procedures

查看:49
本文介绍了如何在Oracle存储过程中给出退货值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们,



这里瞄准新的Oracle Past我在Sql Server上工作,现在我在Oracle中编写了一个存储过程就像这样



Dear Friends,

Here aim New to Oracle Past i worked on Sql Server,Now i written a Stored Procedure in Oracle its like this

create or replace
procedure sample
(

Systemname nvarchar2, 
SystemDesc nvarchar2,
SystemType nchar,
CreatedDate DATE,
SystemStatus nchar,
ModifiedDate date,
DeletedState  nchar,

Output int 



)
as

begin
insert into tbl_system(Systemname,SystemDesc,SystemType,CreatedDate,SystemStatus, modifieddate,DeletedState) values(Systemname,SystemDesc,SystemType,CreatedDate,
SystemStatus,ModifiedDate,DeletedState );



end;



退货输出



当我把这个返回输出像存储过程显示错误



Th错误是错误的(28,1) ):PLS-00103:遇到符号返回



所以我的问题是如何获得与sqlserver相同的返回值

< br $>


问候,



AnilKumar.D


Return Output

When i put this Return Output like Stored Procedure showing Error

Th Error is Error(28,1): PLS-00103: Encountered the symbol "RETURN"

So my Question is how to get the Return value same like sqlserver


Regards,

AnilKumar.D

推荐答案

在oracle中,您将参数声明为out参数以返回值。请参阅下面的示例并相应地调整您的代码。



In oracle you declare parameter as out parameter to return a value. See below example and tweak your code accordingly.

CREATE OR REPLACE PROCEDURE test_proc (
  p_iKey    IN VARCHAR2,
  p_retVal OUT INTEGER
)
AS
BEGIN
  DELETE FROM myTable
   WHERE theKey = p_iKey;

  IF( SQL%ROWCOUNT >= 1 )
  THEN
    p_retVal := 1;
  ELSE
    p_retVal := 0;
  END IF;
END test_proc;


这篇关于如何在Oracle存储过程中给出退货值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆