ado.net读取oracle结果集
时间:2021-07-01 10:21:17
帮助过:12人阅读
/**
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 BEGIN
11
12 select max(t.task_id)
13 into G_HAS_TASK
14 from T_ISDT_VEHICLE_TASK_LAST t
15 where t.car_num
= P_CARNUM
16 and rownum
= 1
17 order by t.created_date
desc;
18
19 if G_HAS_TASK
is not null then
20
21
22 OPEN CUR_OUT
FOR
23 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_bd
32 from T_ISDT_VEHICLE_TASK_LAST t
33 inner join t_isdt_delivery_site ds
34 on t.sender_site_id
= ds.id
35 and ds.state
= 1
36 where t.car_num
= P_CARNUM
37 and rownum
= 1
38 order by t.created_date
desc;
39
40 /*OPEN CUR_CARTASK FOR
41 select vi.id as vehicleID,st.task_id as taskID from T_ISDT_VEHICLE_TASK_LAST st
42 inner join t_isdt_vehicle_info vi on vi.car_num=st.car_num
43 where st.car_num = P_CARNUM and rownum = 1
44 order by st.created_date desc;
45 */
46 --存在任务
47 ----P_STATE := 1;
48 else
49
50 OPEN CUR_OUT
FOR
51 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_bd
60 from dual;
61
62 /*OPEN CUR_CARTASK FOR
63 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结果集
标签:desc har database ade for order com ref art