• Executing a PL/SQL Function


    CREATE OR REPLACE FUNCTION func_RetrieveCount
    RETURN NUMBER
    IS
     intRecordCount NUMBER;
    BEGIN
      SELECT COUNT(*) INTO intRecordCount FROM Products;
     RETURN intRecordCount;
    END;

    /

    private void btnRetrieveCount_Click(object sender, EventArgs e)
    {
      string _connstring = "Data Source=localhost/NEWDB;User 
      Id=EDZEHOO;Password=PASS123;";
     try
            {
        OracleConnection _connObj = new OracleConnection(_connstring);
                    _connObj.Open();
                    OracleCommand _cmdObj = _connObj.CreateCommand();

       _cmdObj.CommandText = "func_RetrieveCount";
                    _cmdObj.CommandType = CommandType.StoredProcedure ;
     
        //Declare the return parameter
                    OracleParameter _retValueParam = new OracleParameter();
                    _retValueParam.ParameterName = "Any_name";
                    _retValueParam.OracleDbType = OracleDbType.Int32;
                    _retValueParam.Direction = ParameterDirection.ReturnValue;
                    _cmdObj.Parameters.Add(_retValueParam);
     
                    _cmdObj.ExecuteNonQuery();
                    MessageBox.Show("The return value is :" + _retValueParam.Value.ToString());
                    _connObj.Close();
                    _connObj.Dispose();
                    _connObj = null;
     }
      catch (Exception ex)
     {
      MessageBox.Show(ex.ToString());
     }
    }

  • 相关阅读:
    课题论文之调研--贝叶斯网络
    Android开发--数据存储之数据库操作
    Android开发--数据存储之File文件存储
    ROS常用命令
    CMakeLists.txt实例运用(入门)
    乐视三合一奥比中光Orbbec Astra Pro在ROS中配置显示RGB、深度、IR图像的两种思路
    VTK显示CT图像视图
    手眼标定
    并联机器人位姿解算
    信息物理融合CPS
  • 原文地址:https://www.cnblogs.com/kingwangzhen/p/1795200.html
Copyright © 2020-2023  润新知