当我尝试执行GET_Card_TRANS
过程时,我收到以下错误:
[code] => 6550
[message] => ORA-06550: line 6, column 21:
PLS-00103: Encountered the symbol "" when expecting one of the following:
. ( ) , * @ % & = - + < / > at in is mod remainder not rem =>
<an exponent (**)> <> or != or ~= >= <= <> and or like like2
like4 likec between || indicator multiset member submultiset
[offset] => 155
[sqltext] => BEGIN
WEB_SHOW.GET_Card_TRANS(
:User_Id,
:Pswd,
:vcard_id
:sdate
:EDATE
:Vcond
:CARD_TRANS_data
);
END;
这是PHP代码:
<?php
// Connect to database
$conn = oci_connect("xxx", "yyy", "aaaa:bb/cc", 'dd');
if (!$conn) {
$e = oci_error($conn);
print_r($e);
exit ("Connection failed.");
}
$user_id = 'demo';
$password = 'password';
$vcard_id = '1-0';
$start_date = '01-01-2016';
$end_date = '01-01-2016';
$condition = '1';
$sql = "BEGIN
web_show.GET_Card_TRANS(
:User_Id,
:Pswd,
:vcard_id
:sdate
:EDATE
:Vcond
:CARD_TRANS_data
);
END;";
$stmt = oci_parse($conn, $sql);
oci_bind_by_name($stmt, ':User_Id', $user_id );
oci_bind_by_name($stmt, ':Pswd', $password );
oci_bind_by_name($stmt, ':vcard_id', $vcard_id );
oci_bind_by_name($stmt, ':sdate', $start_date );
oci_bind_by_name($stmt, ':EDATE', $end_date );
oci_bind_by_name($stmt, ':Vcond', $condition );
// Create a new cursor resource
$curs = oci_new_cursor($conn);
// Bind the cursor resource to the Oracle argument
oci_bind_by_name($stmt,":CARD_TRANS_data",$curs,-1,OCI_B_CURSOR);
if (!oci_execute($stmt)) {
$e = oci_error($stmt);
print_r($e);
exit("Procedure Failed.");
}
// Execute the cursor
if (!oci_execute($curs, OCI_DEFAULT)) {
$e = oci_error($curs);
print_r($e);
exit("Execute cursor Failed.");
}
while (($row = oci_fetch_array($curs, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
print_r($row);
//echo $row['FIRST_NAME'] . "<br />\n";
}
oci_free_statement($stmt);
oci_free_statement($curs);
oci_close($conn);
?>
答案 0 :(得分:1)
可能缺少逗号吗?
此:
$sql = "BEGIN
web_show.GET_Card_TRANS(
:User_Id,
:Pswd,
:vcard_id
:sdate
:EDATE
:Vcond
:CARD_TRANS_data
);
END;"
应改为:
$sql = "BEGIN
web_show.GET_Card_TRANS(
:User_Id,
:Pswd,
:vcard_id,
:sdate,
:EDATE,
:Vcond,
:CARD_TRANS_data
);
END;";