【发布时间】:2019-06-03 09:47:09
【问题描述】:
调用方法时,会发生错误。开括号和闭括号的数量相同。我无法理解错误是什么。
var commandText = "select uwi, well_name, cid_rab, cid, plast, top, base, H_ef, porosity_alt, KH, nas, sat_tek from " +
"(select ws.uwi, h.well_name, h.crstatus, h.class, h.well_type, " +
"(select udmurtneft_n.dg_sdes(hs.ora1) || decode(hs.ora2, null, null, ': ' || udmurtneft_n.dg_sdes(hs.ora2)) " +
"|| decode(hs.ora3, null, null, ', ' || udmurtneft_n.dg_sdes(hs.ora3)) from udmurtneft_n.well_stock_hist_ext hs " +
"|| decode(hs.ora3, null, null, ', ' || udmurtneft_n.dg_sdes(hs.ora3)) from udmurtneft_n.well_stock_hist_ext hs " +
"where decode(instr(ws.uwi,'B'), 0, ws.uwi, substr(ws.uwi, 1, length(ws.uwi)-2)) = hs.uwi and hs.status_date in '01.04.2019') as cid_rab, " +
"udmurtneft_n.dg_sdes(ws.reservoir) as cid, udmurtneft_n.dg_des(ws.layer_id) as plast, ws.top, ws.base, ws.top_dsrd, ws.base_dsrd, " +
"abs(round(ws.top_dsrd,5)-round(ws.base_dsrd,5)) as H_ef, round(ws.permeability_alt,5), ws.porosity_alt, " +
"abs(round(ws.top_dsrd,5)-round(ws.base_dsrd,5))*round(ws.permeability,5) as KH, ws.saturation, udmurtneft_n.dg_des(ws.saturation) as nas, " +
"(select udmurtneft_n.str_sum(distinct ps.top) from unofm.perflayers2 ps " +
"where Uwi = ws.Uwi and ((top>=ws.top and top<ws.base) or (botm>ws.top and botm<=ws.base) or (ws.top>=top and ws.top<botm) or (ws.base>top and ws.base<=botm)) " +
"and ps.dat_perf is not null and Interpreter in (1,3)) top_ps, (select udmurtneft_n.str_sum(distinct ps.botm) from unofm.perflayers2 ps " +
"where Uwi = ws.Uwi and ((top>=ws.top and top<ws.base) or (botm>ws.top and botm<=ws.base) or (ws.top>=top and ws.top<botm) or (ws.base>top and ws.base<=botm)) " +
"and ps.dat_perf is not null and Interpreter in (1,3)) botm_ps, (select udmurtneft_n.str_sum(distinct tt.sat_cat) " +
"from udmurtneft_n.geophys_st st, udmurtneft_n.geophys_st_interpr i, udmurtneft_n.dict_sat tt where st.id=i.id and st.uwi=ws.uwi and trim(tt.sat_rem) = trim(i.saturation) " +
"and((i.top>=ws.top and i.top<ws.base) or (i.bottom>ws.top and i.bottom<=ws.base) or (ws.top>=i.top and ws.top<i.bottom) or (ws.base>i.top and ws.base<=i.bottom))) " +
"as sat_tek from udmurtneft_n.well_log_result_sublayers ws, udmurtneft_n.well_hdr h " +
"where ws.uwi = h.uwi and ws.interpreter in (1,3) and ws.uwi not like '%_F%' and h.field = 510399) " +
"where top_ps is null and H_ef >= 1 and KH > 100 and porosity_alt >= 0.16 " +
"and class = 26690 and crstatus not in (85790, 85850) and well_type is null and uwi not like '%B%' " +
"and saturation in (217463,217443,217483,217603,217683,217783,273943,274003,1083681,1126381) " +
"and(sat_tek is null or (sat_tek not like '%водонасыщенный%' and sat_tek not like '%газонасыщенный%' and sat_tek not like '%газоводонасыщенный%%')) " +
"order by uwi, top";
var command = new OracleCommand();
command.Connection = connection;
command.CommandText = commandText;
using (DbDataReader reader = command.ExecuteReader()) // ERROR
{
using (OracleDataAdapter dataAdapter = new OracleDataAdapter())
{
dataAdapter.SelectCommand = command;
dataAdapter.Fill(dataSet);
}
}
【问题讨论】: