狼
狼崖山
Unregistered / Unconfirmed
GUEST, unregistred user!
ret 和 retchar 为输出参数~ 其他6个为输入参数<br> ADOStoredProc1.ProcedureName:='getplacepass';<br> ADOStoredProc1.Parameters.Refresh;<br> try<br> ADOStoredProc1.Parameters.ParamByName('sBegdate').Value:='20070810101010';<br> ADOStoredProc1.Parameters.ParamByName('sEndDate').Value:='20070810111111';<br> ADOStoredProc1.Parameters.ParamByName('sLong'  .Value:='108.3279840';<br> ADOStoredProc1.Parameters.ParamByName('sLat').Value:='22.8248000';<br> ADOStoredProc1.Parameters.ParamByName('ilimit').Value:='25';<br> ADOStoredProc1.Parameters.ParamByNam('sCompany').Value:='*';<br> ADOStoredProc1.Prepared;<br> ADOStoredProc1.execproc;<br> ret:= ADOStoredProc1.Parameters.ParamByName('ret').Value;<br> retchar:= ADOStoredProc1.Parameters.ParamByName('retchar').Value;<br>except<br>end;<br><br>附件上存储过程<br>create or replace procedure GetPlacePass<br>(sBegdate in varchar2,sEndDate in varchar2,sLong in varchar2,sLat in varchar2,<br>ilimit in number,sCompany in varchar2, ret in out number,retchar in out varchar2)<br>is<br>v_retchar varchar2(4000);<br>v_ret1 varchar2(4000);<br>v_ret2 varchar2(4000);<br>v_ret3 varchar2(4000);<br>v_ret4 varchar2(4000);<br>v_rettmp varchar2(4000);<br> CURSOR c<br> IS<br> SELECT *<br> FROM TABLE (CAST (fn_split (slong, ';') AS ty_str_split<br>  <br> <br><br> r c%ROWTYPE;<br><br> CURSOR d<br> IS<br> SELECT *<br> FROM TABLE (CAST (fn_split (slat, ';') AS ty_str_split<br>  <br> <br><br> s c%ROWTYPE; <br><br>CURSOR e<br> IS<br> SELECT *<br> FROM TABLE (CAST (fn_split (v_retchar, '||') AS ty_str_split<br>  <br> <br><br> t e%ROWTYPE;<br> <br> CURSOR a1<br> IS<br> SELECT *<br> FROM TABLE (CAST (fn_split (v_ret1, ';') AS ty_str_split<br>  <br> <br><br> b1 a1%ROWTYPE;<br> <br> CURSOR a2<br> IS<br> SELECT *<br> FROM TABLE (CAST (fn_split (v_ret2, ';') AS ty_str_split<br>  <br> <br><br> b2 a2%ROWTYPE;<br>ilong number(28,20);<br>ilat number(28,20);<br>i number;<br>tmp_date1 date;<br><br>begin<br> select '' into v_rettmp from dual;<br> tmp_date1:=sysdate;<br> OPEN c;<br> open d;<br><br> LOOP<br> FETCH c INTO r;<br> fetch d into s;<br> EXIT WHEN (c%NOTFOUND or d%notfound);<br> ilong:=to_number(r.column_value);<br> ilat:=to_number(s.column_value);<br> v_retchar:=v_retchar || GetPlaceReTime(sBegdate,sEndDate,iLong,iLat,ilimit,sCompany) || '||';<br> --DBMS_OUTPUT.put_line (r.column_value || '--' || s.column_value);<br> END LOOP;<br><br> v_retchar:=substr(v_retchar,1,length(v_retchar)-2);<br> CLOSE c;<br> close d;<br> i:=1;<br> open e;<br> loop<br> fetch e into t;<br> exit when e%notfound;<br> if i=1 then<br> v_ret1:=t.column_value;<br> v_rettmp:=t.column_value;<br> else<br> v_ret1:=v_rettmp;<br> v_ret2:=t.column_value;<br> open a1;<br> v_rettmp:='';<br> <br> loop<br> fetch a1 into b1;<br> exit when a1%notfound;<br> /*v_rettmp:='';*/<br> open a2;<br> loop<br> fetch a2 into b2;<br> exit when a2%notfound;<br> if b1.column_value=b2.column_value then <br> v_rettmp:=v_rettmp || b1.column_value || ';'; <br> end if;<br> end loop;<br> close a2;<br> end loop;<br> close a1;<br> <br> end if;<br> i:=i+1;<br> end loop;<br> close e;<br> <br> ret:=(sysdate-tmp_date1)* 24 * 60 * 60;<br> retchar:=v_rettmp;<br> <br>end;<br>说明 、:/*<br>取经过多个点的车辆<br>sBegdate 20070810000000<br>sEndDate 20070810000000<br>slong 108.3279840;108.3279840;108.3279840;<br>slat 22.8248000;22.8248000;22.8248000;<br>ilimit 25M<br>sCompany 对应company表的OID字段,全部公司传*<br>ret 执行时间<br>retchar 桂ATA776;桂ATA777;桂ATA778;桂ATA779<br>*/