21,887
社区成员
发帖
与我相关
我的任务
分享
CREATE OR REPLACE PACKAGE CURSPKG AS
TYPE T_CURSOR IS REF CURSOR;
PROCEDURE sp_test (iStartDate date,iEndDate date,iAgentID varchar,iAgentWorkGroup varchar,iType int,iVDNUserName varchar,rCursor IN OUT T_CURSOR);
END CURSPKG;
<?php
try {
$Oracle_conn=oci_connect("icd","icd","IPCC");
$cur=oci_new_cursor($Oracle_conn);
$query="call curspkg.sp_test(:iStartDate,:iEndDate,:iAgentID,:iAgentWorkGroup,:iType,:iVDNUserName,:rcursor );";
$statement=oci_parse($Oracle_conn,$query);
// $iStartDate=date("Y-m-d H:i:s",strtotime("2008-11-20 00:00:00"));
// $iEndDate=date("Y-m-d H:i:s",strtotime("2008-11-21 00:00:00"));
// $iStartDate=date_parse("2008-11-20 00:00:00");
// $iEndDate=date_parse("2008-11-21 00:00:00");
$iStartDate="2008-11-20 00:00:00";
$iEndDate="2008-11-21 00:00:00";
$iAgentID=iconv("utf-8","gb2312","0|所有|0|0");
$iAgentWorkGroup = iconv("utf-8","gb2312","0|所有|0|0");
$iType=1;
$iVDNUserName="102";
oci_bind_by_name($statement,":iStartDate",$iStartDate);
oci_bind_by_name($statement,":iEndDate",$iEndDate);
oci_bind_by_name($statement,":iAgentID",$iAgentID,40);
oci_bind_by_name($statement,":iAgentWorkGroup",$iAgentWorkGroup,40);
oci_bind_by_name($statement,":iType",$iType,2);
oci_bind_by_name($statement,":iVDNUserName",$iVDNUserName,20);
oci_bind_by_name($statement,":rcursor",$cur,-1,OCI_B_CURSOR);
oci_execute($statement);
oci_execute($cur);
oci_fetch_all($cur, $data, 0, -1, OCI_ASSOC+OCI_FETCHSTATEMENT_BY_ROW);
$result = json_encode($data);
oci_free_statement($statement);
oci_close($Oracle_conn);
}catch(Exception $e){
echo $e->getMessage();
}
?>