Ar thematic operator Overflow Oracle ODP.NET

67 views Asked by At

The below query run fine in Oracle when run as a inline query but when i use with .NET using ODP.net I get a arthematic operator overflow. I am not sure why there is a arthmatic operator overflow when run with oracle data adapter from .net

 select project_asset.project_id,
      project_asset.asset_id,
      asset_crv_v.crv$ crv,
      asset_crv_v.crv_percent crv_percent,
      project_asset.expected_useful_life,
      asset.mf_division_id,
      mfdivision.code_desc division_description,
      project_asset.update_asset_base_year_flag,
      sumcost.assetbudgetcost budget_cost,
      sumCost.assetActualCost actual_cost
      from RECAPT.project_asset,
      RECAPT.asset,
      RECAPT.asset_crv_v,
      RECAPT.reference_detail mfdivision,
      (select  project_asset.project_id,
      project_asset.asset_id,
      (nvl(sum(project_asset_mfcode.budget_cost), 0)) assetbudgetcost,
      (nvl(sum(project_asset_mfcode.actual_cost), 0)) assetActualCost
      from RECAPT.project_asset,
      RECAPT.project_asset_mfcode,
      RECAPT.reference_detail mfcode
      where  project_asset.project_id = project_asset_mfcode.project_id(+)
      and project_asset.asset_id = project_asset_mfcode.asset_id(+)
      and project_asset.project_id = 'AMB-Lifecycle-2014'
      and mfcode.id = project_asset_mfcode.mf_code_id
      group by
      project_asset.project_id,
      project_asset.asset_id
      ) sumCost
      where project_asset.project_id = 'AMB-Lifecycle-2014'
      and project_asset.asset_id = asset.id
      and asset.id = asset_crv_v.id(+)
      and mfdivision.id = asset.mf_division_id
      and sumcost.project_id = project_asset.project_id
      and sumcost.asset_id = project_asset.asset_id
      order by project_asset.asset_id

C# Method To Execute Query

 public ProjectDetailAssetCollection Retrieve(ProjectDetailAssetFilterType criteria, OracleConnection oracleConnection)
        {
            var result = new ProjectDetailAssetCollection();
            var parameters = new List<OracleParameter>();

            if (!string.IsNullOrEmpty(criteria.ProjectId))
            {
                parameters.Add(new OracleParameter("p_project_id", criteria.ProjectId));
            }

            DataSet dataSetResults = SharedCodeDA.ExecuteDataSetLeaveConnectionOpen("RetrieveProjectDetailAssets",
                                                                                    oracleConnection, parameters);
            if (dataSetResults.Tables[0].Rows.Count > 0)
            {
                // only allow maximum 500 records to return
                int maxRow = dataSetResults.Tables[0].Rows.Count > SharedCodeDA.MaxRowReturn ? 
                    SharedCodeDA.MaxRowReturn : dataSetResults.Tables[0].Rows.Count;

                for (int i = 0; i < maxRow; i++)
                {
                    DataRow assetFromDatabase = dataSetResults.Tables[0].Rows[i];
                    ProjectDetailAssetType projectDetailAsset = PopulateProjectDetailAssetDEM(assetFromDatabase);
                    result.Add(projectDetailAsset);
                }
            }

            return result;
        }

  public static DataSet ExecuteDataSetLeaveConnectionOpen(OracleCommand command, OracleConnection connection, 
            List<OracleParameter> parameters = null)
        {            
            if (parameters != null)
            {
                //Added by Danny Ho - this is necessary in order to resolve issue with parameterized values 
                //that are not in the same order as the SQL
                command.BindByName = true;
                foreach (OracleParameter item in parameters)
                {
                    command.Parameters.Add(item);
                }
            }

            if (connection != null && (connection.State == ConnectionState.Closed || connection.State != ConnectionState.Open))
            {
                connection.Open();
            }

            OracleDataAdapter dataAdapter = new OracleDataAdapter(command);
            DataSet dataSet = new DataSet();
            dataAdapter.Fill(dataSet);
            command.Parameters.Clear();

            dataAdapter.Dispose();
            command.Parameters.Clear();
            command.Dispose();

            return dataSet;
        }
0

There are 0 answers