首页 > 代码库 > ado.net读取oracle结果集
ado.net读取oracle结果集
1 /** 2 3 4 5 */
---oracle中使用游标返回数据,在ado.net中进行读取 6 PROCEDURE ISDT_VEHICLE_TASK_CHECK(P_CARNUM IN VARCHAR2, 7 CUR_OUT OUT sys_refcursor 8 ) IS 9 G_HAS_TASK varchar2(40); -- 任务编号10 BEGIN11 12 select max(t.task_id)13 into G_HAS_TASK14 from T_ISDT_VEHICLE_TASK_LAST t15 where t.car_num = P_CARNUM16 and rownum = 117 order by t.created_date desc;18 19 if G_HAS_TASK is not null then20 21 22 OPEN CUR_OUT FOR23 select t.task_id,24 ds.id,25 ds.site_code,26 ds.center_lon,27 ds.center_lat,28 ds.latlons,29 ds.center_lon_bd,30 ds.center_lat_bd,31 ds.latlons_bd32 from T_ISDT_VEHICLE_TASK_LAST t33 inner join t_isdt_delivery_site ds34 on t.sender_site_id = ds.id35 and ds.state = 136 where t.car_num = P_CARNUM37 and rownum = 138 order by t.created_date desc;39 40 /*OPEN CUR_CARTASK FOR41 select vi.id as vehicleID,st.task_id as taskID from T_ISDT_VEHICLE_TASK_LAST st42 inner join t_isdt_vehicle_info vi on vi.car_num=st.car_num43 where st.car_num = P_CARNUM and rownum = 144 order by st.created_date desc;45 */46 --存在任务47 ----P_STATE := 1;48 else49 50 OPEN CUR_OUT FOR51 select ‘‘ as task_id,52 ‘‘ as id,53 ‘‘ as site_code,54 ‘‘ as center_lon,55 ‘‘ as center_lat,56 ‘‘ as latlons,57 ‘‘ as center_lon_bd,58 ‘‘ as center_lat_bd,59 ‘‘ as latlons_bd60 from dual;61 62 /*OPEN CUR_CARTASK FOR63 select ‘‘ as vehicleID,‘‘ as taskID from dual;*/64 65 --不存在任务66 ----P_STATE := 0;67 end if;68 END ISDT_VEHICLE_TASK_CHECK;
ado.net读取oracle雷彪
/// <summary> /// wyg 2017-3-10 /// </summary> /// <param name="vehicleNo"></param> /// <returns></returns> public List<AreaSite> CheckVehicleInTask(string vehicleNo, out string vehicleId, out string taskId) { vehicleId = taskId = string.Empty; var list = new List<AreaSite>(); Database database = DBHelper.CreateDataBase(); DbCommand command = database.GetStoredProcCommand("ISDT_VEHICLE_DATA_SYNC.ISDT_VEHICLE_TASK_CHECK"); database.AddInParameter(command, "P_CARNUM", DbType.String, vehicleNo); using (IDataReader reader = database.ExecuteReader(command)) { while (reader.Read()) { list.Add(new AreaSite(reader)); } if (reader.NextResult()) { if (!reader.IsDBNull(0)) { vehicleId = reader.GetString(0); } if (!reader.IsDBNull(1)) { taskId = reader.GetString(1); } } } return list; }
ORACLE中返回多个游标信息:http://www.360doc.com/content/10/0511/23/1121193_27150614.shtml
ado.net读取oracle结果集
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。