码迷,mamicode.com
首页 > 数据库 > 详细

C# 获取 oracle 存储过程的 返回值

时间:2016-07-01 10:09:00      阅读:383      评论:0      收藏:0      [点我收藏+]

标签:

存储过程
CREATE OR REPLACE PROCEDURE ADMIN.INSERT_OBJ (
   OBJEFIRT_parms      IN     NVARCHAR2,
   OBJEDATT_parms      IN     NVARCHAR2,
   OBJESECT_parms      IN     NVARCHAR2,
   OBJECONTENT_parms   IN     NVARCHAR2,
   ISRELEASE_parms     IN     INTEGER,
   OBJECODE_parms      IN     NVARCHAR2,
   TAGS_parms          IN     NVARCHAR2,
   OBJ_ID_parms           OUT INTEGER
)
IS
BEGIN
   INSERT INTO ADMIN.CB_OBJECT (OBJEID,
                                OBJEFIRT,
                                OBJEDATT,
                                OBJESECT,
                                OBJECONTENT,
                                ISRELEASE,
                                OBJECODE,
                                TAGS)
     VALUES   (ADMIN.CYANBIRD.NEXTVAL,
               OBJEFIRT_parms,
               TO_DATE (OBJEDATT_parms, YYYY-MM-DD hh24:mi:ss),
               OBJESECT_parms,
               OBJECONTENT_parms,
               ISRELEASE_parms,
               OBJECODE_parms,
               TAGS_parms)
     RETURN   OBJEID     INTO   OBJ_ID_parms;

   RETURN;
EXCEPTION
   WHEN NO_DATA_FOUND
   THEN
      NULL;
   WHEN OTHERS
   THEN
      -- Consider logging the error and then re-raise
      RAISE;
END INSERT_OBJ;
C#中获取值

                DbParameter[] paras = new OracleParameter[8];
                paras[0] = new OracleParameter("OBJEFIRT_parms", OracleType.NVarChar);
                paras[0].Value = cbinf.ObjeFirT;
                paras[1] = new OracleParameter("OBJEDATT_parms", OracleType.NVarChar);
                paras[1].Value=cbinf.ObjeDatT.ToString();
                paras[2]= new OracleParameter("OBJESECT_parms",OracleType.NVarChar);
                paras[2].Value = cbinf.ObjeSecT;
                paras[3] = new OracleParameter("OBJECONTENT_parms", OracleType.NVarChar);
                paras[3].Value = cbinf.ObjeContent;
                paras[4] = new OracleParameter("ISRELEASE_parms", OracleType.Int32);
                paras[4].Value = cbinf.IsRelease;
                paras[5] = new OracleParameter("OBJECODE_parms", OracleType.NVarChar);
                paras[5].Value = cbinf.ObjeCode;
                paras[6] = new OracleParameter("TAGS_parms", OracleType.NVarChar);
                paras[6].Value = cbinf.Tags;
                paras[7] = new OracleParameter("OBJ_ID_parms", OracleType.Int32);
                paras[7].Direction = ParameterDirection.Output;
                SQLHelper.ExecuteScaler(InsertInfo_Obj, CommandType.StoredProcedure, paras);
                int i=Convert.ToInt32(paras[7].Value);
                return i;



C# 获取 oracle 存储过程的 返回值

标签:

原文地址:http://www.cnblogs.com/zcwry/p/5631965.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!