zoukankan      html  css  js  c++  java
  • 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());
     }
    }

  • 相关阅读:
    spring + velocity实现分页程序
    Velocity分页模板
    .Net之NVelocity的三种用法
    .Net下模板引擎NVelocity的封装类――VelocityHelper
    NVelocity系列:NVelocity的语法及指令
    Velocity用户手册
    NVelocity的增强功能
    NVelocity配置详解
    报Error creating bean with name 'dataSource' defined in class path resource 报错解决办法
    如何向老外索要代码【转】
  • 原文地址:https://www.cnblogs.com/kingwangzhen/p/1795200.html
Copyright © 2011-2022 走看看